[MPlayer-dev-eng] [PATCH] Metadata retrieval from FLAc audio files.
Reimar.Doeffinger at stud.uni-karlsruhe.de
Sun Mar 12 16:10:19 CET 2006
On Sun, Mar 12, 2006 at 12:34:33PM +0100, Benjamin Zores wrote:
> On Sat, 11 Mar 2006 14:18:06 +0100
> Benjamin Zores <ben at geexbox.org> wrote:
> >On Sat, Mar 11, 2006 at 02:18:06PM +0100, Benjamin Zores wrote:
> >> + length = le2me_32 (*(uint32_t *) ptr);
> >> + ptr += 4 + length;
> >> +
> >> + user_comment_list_length = le2me_32 (*(uint32_t *) ptr);
> >> + ptr += 4;
> > Since ptr AFAICT might be non-aligned, casting to (uint32_t *) is wrong.
> Anyhow, what do you suggest to do then ?
> When not cast, MPlayer crashes.
Which points to another problem: the code does not check things like
e.g. lenght and thus crashes instead of gracefully handle random junk.
> This piece of code was taken from latest xine-lib, only adapted to MPlayer's API.
> But the algorithm/way_it_is_done behind isn't mine.
interesting that this didn't provoke flames from Mike for writing
non-portable code *g*. Because if I am right about ptr being
non-aligned, this will crash on e.g. SPARC machines.
> Just tell me how to solve the dilemna and I'll update my patch.
Something like e.g.
length = (ptr << 24) | (ptr << 16) | (ptr << 8) | ptr;
length = le2me_32 (*(uint32_t *) ptr);
should do it.
More information about the MPlayer-dev-eng