jpeg: add jpeg_fetch_size()

This aids the fuzzer test case.

Change-Id: Ic7d43b76cf5660e085e7b3b13499de0358c13197
Signed-off-by: Patrick Georgi <patrick@georgi-clan.de>
Reviewed-on: http://review.coreboot.org/12181
Reviewed-by: Martin Roth <martinroth@google.com>
Tested-by: build bot (Jenkins)
This commit is contained in:
Patrick Georgi 2015-08-09 18:23:10 +02:00 committed by Patrick Georgi
parent a5c5db37ee
commit 246179a808
2 changed files with 13 additions and 0 deletions

View File

@ -257,6 +257,18 @@ static int dec_checkmarker(void)
return 0;
}
void jpeg_fetch_size(unsigned char *buf, int *width, int *height)
{
datap = buf;
getbyte();
getbyte();
readtables(M_SOF0);
getword();
getbyte();
*height = getword();
*width = getword();
}
int jpeg_check_size(unsigned char *buf, int width, int height)
{
datap = buf;

View File

@ -49,6 +49,7 @@ struct jpeg_decdata {
};
int jpeg_decode(unsigned char *, unsigned char *, int, int, int, struct jpeg_decdata *);
void jpeg_fetch_size(unsigned char *buf, int *width, int *height);
int jpeg_check_size(unsigned char *, int, int);
#endif