[MPlayer-cvslog] r38224 - trunk/libmpcodecs/ad_hwmpa.c

reimar subversion at mplayerhq.hu
Wed Jan 20 20:03:34 EET 2021


Author: reimar
Date: Wed Jan 20 20:03:34 2021
New Revision: 38224

Log:
ad_hwmpa.c: avoid potential out of bounds.

This happens when the frame size is larger than the
size of the decoded audio - obviously this should not
happen in real audio files as it doesn't make sense
to select a compression mode that increases size.
Note that unless all other MPEG audio codecs are disabled
this codec will never be auto-selected.

Fixes trac issue #2357.

Modified:
   trunk/libmpcodecs/ad_hwmpa.c

Modified: trunk/libmpcodecs/ad_hwmpa.c
==============================================================================
--- trunk/libmpcodecs/ad_hwmpa.c	Wed Jan 20 20:03:33 2021	(r38223)
+++ trunk/libmpcodecs/ad_hwmpa.c	Wed Jan 20 20:03:34 2021	(r38224)
@@ -133,7 +133,8 @@ static int decode_audio(sh_audio_t *sh,u
                 break;
 	}
 
-	memset(&buf[tot], 0, tot2-tot);
+	if (tot > tot2) mp_msg(MSGT_DECAUDIO,MSGL_ERR,"MPEG audio frame is larger than decoded data (%i > %i)!\n", tot, tot2);
+	else memset(&buf[tot], 0, tot2-tot);
 	return tot2;
 }
 


More information about the MPlayer-cvslog mailing list