mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
PNG screenshots: fix oob read of malloc'd mem on Windows.
These could manifest themselves as garbage lines on the bottom and happened because of the ydim vs. bytesperline discrepancy again. git-svn-id: https://svn.eduke32.com/eduke32@2844 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
2a2f56f510
commit
49ab0eb6e9
1 changed files with 3 additions and 2 deletions
|
@ -15964,8 +15964,8 @@ static int32_t screencapture_png(const char *filename, char inverseit, const cha
|
||||||
begindrawing(); //{{{
|
begindrawing(); //{{{
|
||||||
if (palette)
|
if (palette)
|
||||||
{
|
{
|
||||||
buf = (png_bytep)png_malloc(png_ptr, xdim*ydim);
|
buf = (png_bytep)png_malloc(png_ptr, bytesperline*ydim);
|
||||||
Bmemcpy(buf, (char *)frameplace, xdim*ydim);
|
Bmemcpy(buf, (char *)frameplace, bytesperline*ydim);
|
||||||
}
|
}
|
||||||
# ifdef USE_OPENGL
|
# ifdef USE_OPENGL
|
||||||
else
|
else
|
||||||
|
@ -15977,6 +15977,7 @@ static int32_t screencapture_png(const char *filename, char inverseit, const cha
|
||||||
enddrawing(); //}}}
|
enddrawing(); //}}}
|
||||||
|
|
||||||
rowptrs = (png_bytepp)png_malloc(png_ptr, ydim*sizeof(png_bytep));
|
rowptrs = (png_bytepp)png_malloc(png_ptr, ydim*sizeof(png_bytep));
|
||||||
|
|
||||||
if (!palette)
|
if (!palette)
|
||||||
{
|
{
|
||||||
for (i=0; i<ydim; i++)
|
for (i=0; i<ydim; i++)
|
||||||
|
|
Loading…
Reference in a new issue