Hi,
converting a HEIC image shot on an iPhone 13 to either a JPEG or PNG results into the image being flipped (wrongly rotated) for some images.
Looking at the EXIF data of the converted JPEG it looks like it just sets the orientation to 3 for every image.

I'll also attach the test HEIC file if you want to debug it (it's zipped because Github does not allow HEIC files)
heic.heic.zip