Skip to content

Commit 8bd8cde

Browse files
dingintel2021XinfengZhang
authored andcommitted
[Decode] Add checking of stream_scan size
Signed-off-by: dingintel2021 <[email protected]>
1 parent 0561789 commit 8bd8cde

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

decode/tinyjpeg.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,13 @@ static int parse_JFIF(struct jdec_private *priv, const unsigned char *stream)
486486
printf("ERROR:Sampling other than 1x1 for Cr and Cb is not supported");
487487
#endif
488488
findEOI(priv, stream);
489+
490+
if (priv->stream_scan > priv->stream_end)
491+
{
492+
error("stream_scan cannot exceed stream_end\n");
493+
return -1;
494+
}
495+
489496
return next_image_found;
490497
}
491498

0 commit comments

Comments
 (0)