X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fmodules%2Fswfbits.c;h=4643551695a7c0348d8e1c75ba1e19bcf1f6f900;hb=cde153b0547e260367cc82ea7563ff8689cb61d8;hp=88ba8b97dee46cfac6bd382ff3125e78b7735bf5;hpb=43917185524682e1cbee50d711fcd2c0fd5d4c5c;p=swftools.git diff --git a/lib/modules/swfbits.c b/lib/modules/swfbits.c index 88ba8b9..4643551 100644 --- a/lib/modules/swfbits.c +++ b/lib/modules/swfbits.c @@ -561,7 +561,8 @@ static void tag_init_source(struct jpeg_decompress_struct *cinfo) static boolean tag_fill_input_buffer(struct jpeg_decompress_struct *cinfo) { TAG *tag = (TAG *) cinfo->client_data; - if (tag->data[tag->pos + 0] == 0xff && + if (tag->pos + 4 <= tag->len && + tag->data[tag->pos + 0] == 0xff && tag->data[tag->pos + 1] == 0xd9 && tag->data[tag->pos + 2] == 0xff && tag->data[tag->pos + 3] == 0xd8) { @@ -1181,9 +1182,15 @@ TAG* swf_AddImage(TAG*tag, int bitid, RGBA*mem, int width, int height, int quali int has_alpha = swf_ImageHasAlpha(mem,width,height); /* try lossless image */ + +#ifdef NO_LOSSLESS + tag1 = swf_InsertTag(0, /*ST_DEFINEBITSLOSSLESS1/2*/0); + tag1->len = 0x7fffffff; +#else tag1 = swf_InsertTag(0, /*ST_DEFINEBITSLOSSLESS1/2*/0); swf_SetU16(tag1, bitid); swf_SetLosslessImage(tag1, mem, width, height); +#endif #if defined(HAVE_JPEGLIB) /* try jpeg image */