[MPlayer-dev-eng] hwac3 on FreeBSD
Anssi Saari
as at sci.fi
Fri Sep 13 23:07:19 CEST 2002
Hi,
Noticed this slight problem with hwac3 on FreeBSD, namely mplayer
segfaults almost immediately. And why? Function decode_audio in
libmpcodecs/ad_hwac3.c calls swab() with a len=-1. Fine in Linux since
swab() there does nothing if len is negative. But in FreeBSD len is
type size_t i.e. unsigned int, so len=-1 is really quite big and causes
an almost certain segfault.
So, something like the patch below should probably be done. I can't
really test now since ad_acm.c, vd_vfw.c and ve_vfw.c all refer
to undefined win32_codec_name...
--- libmpcodecs/ad_hwac3.c.orig Fri Sep 13 23:45:11 2002
+++ libmpcodecs/ad_hwac3.c Fri Sep 13 23:55:33 2002
@@ -96,6 +96,9 @@
buf[5] = 0x00;
buf[6] = (len << 3) & 0xFF;
buf[7] = (len >> 5) & 0xFF;
+#ifdef __FreeBSD__
+ if(len > -1)
+#endif
swab(sh_audio->a_in_buffer, buf + 8, len);
//memcpy(buf + 8, sh_audio->a_in_buffer, len);
memset(buf + 8 + len, 0, 6144 - 8 - len);
More information about the MPlayer-dev-eng
mailing list