mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-03-31 23:59:34 +00:00
avcodec/cbs_jpeg: Fix infinite loop in cbs_jpeg_split_fragment()
Fixes: Timeout Fixes: 21104/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-5129580475318272 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
9874815b1a
commit
a3dc67c984
@ -148,15 +148,14 @@ static int cbs_jpeg_split_fragment(CodedBitstreamContext *ctx,
|
|||||||
if (marker == JPEG_MARKER_EOI) {
|
if (marker == JPEG_MARKER_EOI) {
|
||||||
break;
|
break;
|
||||||
} else if (marker == JPEG_MARKER_SOS) {
|
} else if (marker == JPEG_MARKER_SOS) {
|
||||||
|
next_marker = -1;
|
||||||
for (i = start; i + 1 < frag->data_size; i++) {
|
for (i = start; i + 1 < frag->data_size; i++) {
|
||||||
if (frag->data[i] != 0xff)
|
if (frag->data[i] != 0xff)
|
||||||
continue;
|
continue;
|
||||||
end = i;
|
end = i;
|
||||||
for (++i; i + 1 < frag->data_size &&
|
for (++i; i + 1 < frag->data_size &&
|
||||||
frag->data[i] == 0xff; i++);
|
frag->data[i] == 0xff; i++);
|
||||||
if (i + 1 >= frag->data_size) {
|
if (i + 1 < frag->data_size) {
|
||||||
next_marker = -1;
|
|
||||||
} else {
|
|
||||||
if (frag->data[i] == 0x00)
|
if (frag->data[i] == 0x00)
|
||||||
continue;
|
continue;
|
||||||
next_marker = frag->data[i];
|
next_marker = frag->data[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user