summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Heron <phil@sanslogic.co.uk>2011-06-24 23:24:12 +0100
committerPhilip Heron <phil@sanslogic.co.uk>2011-06-24 23:24:12 +0100
commitca837206d582b6a06b4c18234ffdf1bcd8c487f7 (patch)
tree0af1e2b318ef0bf3093ec2aa030b91b7e6eedc04
parent2c90f35f9232316c6e718ba5f76a78045efb189d (diff)
Add more rules to make sure image is valid
-rw-r--r--ssdv.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/ssdv.c b/ssdv.c
index 41527b5..fe01018 100644
--- a/ssdv.c
+++ b/ssdv.c
@@ -498,6 +498,11 @@ static char ssdv_have_marker(ssdv_t *s)
s->state = S_MARKER_DATA;
break;
+ case J_SOF2:
+ /* Don't do progressive images! */
+ fprintf(stderr, "Error: Progressive images not supported\n");
+ return(SSDV_ERROR);
+
case J_DHT:
case J_DQT:
/* Copy the tables into memory */
@@ -555,6 +560,13 @@ static char ssdv_have_marker_data(ssdv_t *s)
return(SSDV_ERROR);
}
+ /* Maximum image is 4080x4080 */
+ if(s->width > 4080 || s->height > 4080)
+ {
+ fprintf(stderr, "Error: The image is too big. Maximum resolution is 4080x4080\n");
+ return(SSDV_ERROR);
+ }
+
/* The image dimensions must be a multiple of 16 */
if((s->width & 0x0F) || (s->height & 0x0F))
{