Fix a potential heap overflow when playing uncompressed pcm audio.

ok pvalchev@
This commit is contained in:
biorn 2005-08-29 06:53:54 +00:00
parent d36666f229
commit 66966fa462
2 changed files with 16 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.88 2005/08/27 21:11:49 espie Exp $
# $OpenBSD: Makefile,v 1.89 2005/08/29 06:53:54 biorn Exp $
# May not be hard to add more.
ONLY_FOR_ARCHS= amd64 i386 powerpc sparc64 arm
@ -7,7 +7,7 @@ COMMENT= "Movie player supporting MPEG, DivX, AVI, ASF, MOV & more"
DISTNAME= MPlayer-1.0pre7
DIST_SUBDIR= mplayer
PKGNAME= ${DISTNAME:L}p4
PKGNAME= ${DISTNAME:L}p5
CATEGORIES= x11
EXTRACT_SUFX= .tar.bz2

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-libmpcodecs_ad_pcm_c,v 1.1 2005/08/29 06:53:54 biorn Exp $
--- libmpcodecs/ad_pcm.c.orig Sun Feb 27 00:02:09 2005
+++ libmpcodecs/ad_pcm.c Sat Aug 27 23:38:30 2005
@@ -96,8 +96,8 @@ static int control(sh_audio_t *sh,int cm
static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen)
{
- int len=sh_audio->channels*sh_audio->samplesize-1;
- len=(minlen+len)&(~len); // sample align
+ unsigned len = sh_audio->channels*sh_audio->samplesize;
+ len = maxlen - maxlen % len; // sample align
len=demux_read_data(sh_audio->ds,buf,len);
return len;
}