[coreboot-gerrit] New patch to review for coreboot: jpeg: add jpeg_fetch_size()

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Tue Oct 27 22:21:14 CET 2015


Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/12181

-gerrit

commit 5e34ef3010fd640219013e095fa004e7b25e84b6
Author: Patrick Georgi <patrick at georgi-clan.de>
Date:   Sun Aug 9 18:23:10 2015 +0200

    jpeg: add jpeg_fetch_size()
    
    This aids the fuzzer test case.
    
    Change-Id: Ic7d43b76cf5660e085e7b3b13499de0358c13197
    Signed-off-by: Patrick Georgi <patrick at georgi-clan.de>
---
 src/lib/jpeg.c | 12 ++++++++++++
 src/lib/jpeg.h |  1 +
 2 files changed, 13 insertions(+)

diff --git a/src/lib/jpeg.c b/src/lib/jpeg.c
index a86ea06..8d370ec 100644
--- a/src/lib/jpeg.c
+++ b/src/lib/jpeg.c
@@ -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;
diff --git a/src/lib/jpeg.h b/src/lib/jpeg.h
index a32e4af..bdde8a4 100644
--- a/src/lib/jpeg.h
+++ b/src/lib/jpeg.h
@@ -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



More information about the coreboot-gerrit mailing list