unaligned access on 64-bit platform
I was getting the following error when playing some (not all) ogg vorbis streams:
Unaligned access pid=54825 <ogg123> va=0x11fff96b4 pc=0x3ffbffe9ba0
ra=0x3ff801b4b68 inst=0xa6100000
Segmentation fault (core dumped)
The crash is happening in icomp(), lib/floor1.c. I tracked it down to the qsort
that calls icomp() passing an incorrect size argument. It uses sizeof(int) when
it means sizeof(int*). This only shows up on machines where a pointer is begger
than an int, that is generally 64-bit platforms.
Here is a patch for 1.0rc2 -- I couldn't determine if you've already fixed this
problem because I wasn't able to get anon cvs working.
--- lib/floor1.c.orig Mon Aug 13 07:33:39 2001
+++ lib/floor1.c Fri Nov 9 15:29:56 2001
@@ -226,7 +226,7 @@
/* also store a sorted position index */
for(i=0;i<n;i++)sortpointer[i]=info->postlist+i;
- qsort(sortpointer,n,sizeof(int),icomp);
+ qsort(sortpointer,n,sizeof(int*),icomp);
/* points from sort order back to range number */
for(i=0;i<n;i++)look->forward_index[i]=sortpointer[i]-info->postlist;
--Chouser