ref: 61a0253a481dd18f7fa3a4161f43dc333860050e
parent: 24abb9d7fe77897f576e68e0473e0d6be22d2628
author: Sebastian Rasmussen <[email protected]>
date: Wed Jun 12 21:35:36 EDT 2019
jbig2dec: Validate coordinates when add image onto page. Detected by Coverity in CID 94850.
--- a/jbig2_page.c
+++ b/jbig2_page.c
@@ -34,6 +34,9 @@
#include "jbig2_page.h"
#include "jbig2_segment.h"
+#if !defined (INT32_MAX)
+#define INT32_MAX 0x7fffffff
+#endif
#if !defined (UINT32_MAX)
#define UINT32_MAX 0xffffffff
#endif
@@ -265,6 +268,9 @@
jbig2_page_add_result(Jbig2Ctx *ctx, Jbig2Page *page, Jbig2Image *image, uint32_t x, uint32_t y, Jbig2ComposeOp op)
{
int code;
+
+ if (x > INT32_MAX || y > INT32_MAX)
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "unsupported image coordinates");
/* ensure image exists first */
if (page->image == NULL)