summaryrefslogtreecommitdiff
path: root/src/lib/jpeg.c
diff options
context:
space:
mode:
authorPatrick Georgi <patrick@georgi-clan.de>2015-08-09 18:23:10 +0200
committerPatrick Georgi <pgeorgi@google.com>2015-10-28 19:15:17 +0100
commit246179a8089087059714bd36b8e0f4ad92d24c00 (patch)
tree37aff686d76783ae370c12ccb9f820f8f0464a2a /src/lib/jpeg.c
parenta5c5db37eecc056792be72f6ef71d4ea6f1a7207 (diff)
downloadcoreboot-246179a8089087059714bd36b8e0f4ad92d24c00.tar.xz
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)
Diffstat (limited to 'src/lib/jpeg.c')
-rw-r--r--src/lib/jpeg.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/jpeg.c b/src/lib/jpeg.c
index a86ea06661..8d370ec67b 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;