JPEG module assumes markers are unique
Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=6601
Reported by Jonas Wallden jonasw@roxen.com
API calls involving JPEG markers assume that a marker can only occur once per image. This assumption is incorrect and leads to random hiding of valuable data, e.g. XMP metadata which is tagged with the same APP1 tag as Exif.
A slightly patched image_jpeg.c logs the following marker sequence for a sample image:
> Image.JPEG.decode_header(Stdio.read_bytes("/home/jonasw/Desktop/xmp-ok.jpg"));
MARKER: 226
MARKER: 254
MARKER: 254
MARKER: 237
MARKER: 225
MARKER: 225
MARKER: 238