Mercurial > mplayer.hg
diff Gui/bitmap.c @ 7352:757e876d36fe
Off-by-one error allocating bitmap, when (width*height) % 8 != 0
The code was writing beyond allocated memory, and could corrupt malloc heap.
author | jkeil |
---|---|
date | Tue, 10 Sep 2002 12:38:19 +0000 |
parents | 634d93c68912 |
children | 30a9a6358ee9 |
line wrap: on
line diff
--- a/Gui/bitmap.c Mon Sep 09 22:48:39 2002 +0000 +++ b/Gui/bitmap.c Tue Sep 10 12:38:19 2002 +0000 @@ -114,7 +114,7 @@ out->Width=in->Width; out->Height=in->Height; out->BPP=1; - out->ImageSize=out->Width * out->Height / 8; + out->ImageSize=(out->Width * out->Height + 7) / 8; mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[c1to32] imagesize: %d\n",out->ImageSize ); out->Image=(char *)calloc( 1,out->ImageSize ); if ( out->Image == NULL ) mp_msg( MSGT_GPLAYER,MSGL_STATUS,"nem van ram baze\n" );