fixed bad memory access problem with some jpeg images
[swftools.git] / src / swfextract.c
index 312d9da..b2e049c 100644 (file)
@@ -114,6 +114,7 @@ int args_callback_option(char*name,char*val)
            fprintf(stderr, "Only one --jpegs argument is allowed. (Try to use a range, e.g. -j 1,2,3)\n");
            exit(1);
        }
+       /* TODO: count number of IDs in val range */
        numextracts++;
        extractjpegids = val;
        return 1;
@@ -617,7 +618,7 @@ int findjpegboundary(U8*data, int len)
 {
     int t;
     int pos=-1;
-    for(t=0;t<len;t++) {
+    for(t=0;t<len-4;t++) {
        if(data[t  ]==0xff &&
           data[t+1]==0xd9 &&
           data[t+2]==0xff &&