Re: [AD] patch for the FLC reader

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> More or less, Allegro doesn't skip the chunks, Allegro tries to read
> the next chunk, but fails because uses the alignment byte (=0) to read
> the chunk size and then the chunk type (in this instance we could get
> any error (an invalid chunk type or a valid chunk type with erroneous
> data)).

Ok, that's what I supposed.

> Yes, you're right, they're obsolete, also, those lines are a bad
> implementation because we can't add more size to a chunk when it
> doesn't need it.

Maybe they were put there to compensate at the end of the frame the 
discrepancy created by not taking into account the alignment.

> About the decrement, I didn't see before, but it's important, because
> the "_fli_parse_chunk" routine makes some checks with it.

Yes, but the error was in the right direction (frame_size too big) so I don't 
think it can have actually caused any problems.

> At the end, the patch should be:
>
> @@ -770,9 +770,6 @@
>        sz = chunk.size - sizeof_FLI_CHUNK;
>        frame_size -= chunk.size;
>
> -      if (c == frame_header.chunks-1)
> -	 sz += frame_size;
> -
>        switch (chunk.type) {
>
>  	 case 4:
> @@ -809,6 +806,12 @@
>        }
>
>        p += sz;
> +
> +      /* alignment */
> +      if (sz & 1) {
> +	 p++;
> +	 frame_size--;
> +      }
>     }
>
>     /* move on to the next frame */

Applied to mainline and branch.

Thanks.

-- 
Eric Botcazou




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/