X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Frfxswf.c;h=e3f174ff149d8a86b1cc80a6c41fd89621c10c8d;hb=b3bf5bf6cdf7d80df45de711b079ce3544acd39f;hp=f40d71989e604fae1b2e305c16465e4b9d46dfa3;hpb=b3ae7bccfb9f4ed16e26631fee072fa011f9847e;p=swftools.git diff --git a/lib/rfxswf.c b/lib/rfxswf.c index f40d719..e3f174f 100644 --- a/lib/rfxswf.c +++ b/lib/rfxswf.c @@ -52,8 +52,8 @@ TAG * swf_NextTag(TAG * t) { return t->next; } TAG * swf_PrevTag(TAG * t) { return t->prev; } int swf_GetFrameNo(TAG * t) { return t->frame; } U16 swf_GetTagID(TAG * t) { return t->id; } -U32 swf_GetDataSize(TAG * t) { return t->len; } -U8* swf_GetDataSizePtr(TAG * t) { return &(t->data[t->len]); } +U32 swf_GetTagLen(TAG * t) { return t->len; } +U8* swf_GetTagLenPtr(TAG * t) { return &(t->data[t->len]); } U32 swf_GetTagPos(TAG * t) { return t->pos; } // Basic Data Access Functions @@ -354,6 +354,10 @@ int swf_SetMatrix(TAG * t,MATRIX * m) { swf_SetBits(t,1,1); nbits = swf_CountBits(m->sx,0); nbits = swf_CountBits(m->sy,nbits); + if(nbits>=32) { + fprintf(stderr,"rfxswf: Error: matrix values too large\n"); + nbits = 31; + } swf_SetBits(t,nbits,5); swf_SetBits(t,m->sx,nbits); swf_SetBits(t,m->sy,nbits); @@ -364,6 +368,10 @@ int swf_SetMatrix(TAG * t,MATRIX * m) { swf_SetBits(t,1,1); nbits = swf_CountBits(m->r0,0); nbits = swf_CountBits(m->r1,nbits); + if(nbits>=32) { + fprintf(stderr,"rfxswf: Error: matrix values too large\n"); + nbits = 31; + } swf_SetBits(t,nbits,5); swf_SetBits(t,m->r0,nbits); swf_SetBits(t,m->r1,nbits); @@ -371,6 +379,10 @@ int swf_SetMatrix(TAG * t,MATRIX * m) nbits = swf_CountBits(m->tx,0); nbits = swf_CountBits(m->ty,nbits); + if(nbits>=32) { + fprintf(stderr,"rfxswf: Error: matrix values too large\n"); + nbits = 31; + } swf_SetBits(t,nbits,5); swf_SetBits(t,m->tx,nbits); swf_SetBits(t,m->ty,nbits); @@ -734,7 +746,7 @@ int swf_WriteSWF(int handle,SWF * swf) // Writes SWF to file, returns lengt swf_SetU16(&t1,swf->frameRate); swf_SetU16(&t1,swf->frameCount); - l = swf_GetDataSize(&t1); + l = swf_GetTagLen(&t1); swf->fileSize = l+len; t1.len = 4; // bad & ugly trick ! swf_SetU32(&t1,swf->fileSize);