Fixes Ticket267
Unified · Split
| @@ -881,9 +881,12 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, i · 880 unmodified lines | ||
| 881 | 881 | } |
| 882 | 882 | } |
| 883 | 883 | |
| 884 | − if (s->restart_interval && !--s->restart_count) { | |
| 884 | + if (s->restart_interval && show_bits(&s->gb, 8) == 0xFF){/* skip RSTn */ | |
| 885 | + --s->restart_count; | |
| 885 | 886 | align_get_bits(&s->gb); |
| 886 | − skip_bits(&s->gb, 16); /* skip RSTn */ | |
| 887 | + while(show_bits(&s->gb, 8) == 0xFF) | |
| 888 | + skip_bits(&s->gb, 8); | |
| 889 | + skip_bits(&s->gb, 8); | |
| 887 | 890 | for (i=0; i<nb_components; i++) /* reset dc */ |
| 888 | 891 | s->last_dc[i] = 1024; |
| 889 | 892 | } |