Skip to content

Commit

Permalink
xvjpeg.c: Fix a bad memory access on jpegs with inverted data
Browse files Browse the repository at this point in the history
  • Loading branch information
william8000 committed Sep 1, 2024
1 parent b5bd5c2 commit f94cb44
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/xvjpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,13 +693,14 @@ int LoadJFIF(char *fname, PICINFO *pinfo, int quick)
if (cinfo.saw_Adobe_marker) { /* assume inverted data */
register byte *q = pic;

do {
while (q < pic_end) {
register int cmy, k = 255 - q[3];

if ((cmy = *q++ - k) < 0) { cmy = 0; } *p++ = cmy; /* R */
if ((cmy = *q++ - k) < 0) { cmy = 0; } *p++ = cmy; /* G */
if ((cmy = *q++ - k) < 0) { cmy = 0; } *p++ = cmy; /* B */
} while (++q <= pic_end);
q++;
}
}
else { /* assume normal data */
register byte *q = pic;
Expand Down

0 comments on commit f94cb44

Please sign in to comment.