diff --git a/src/xvjpeg.c b/src/xvjpeg.c index badde04..3a0c4bb 100644 --- a/src/xvjpeg.c +++ b/src/xvjpeg.c @@ -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;