From: H.G. Muller Date: Sat, 16 Apr 2011 08:25:53 +0000 (+0200) Subject: Fix size limit on 'save as diagram' X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=6e81557cc7a3d288c2b0860675b83d2c50d672e9;p=xboard.git Fix size limit on 'save as diagram' In stead of a fixed-size buffer the diagram-save code now uses an allocated buffer with size calculated from the bitmap parameters to retreive the bitmap data, so it should work for all sizes. --- diff --git a/winboard/winboard.c b/winboard/winboard.c index 07e4bd2..50d82dd 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -3842,11 +3842,11 @@ HDCDrawPosition(HDC hdc, BOOLEAN repaint, Board board) boardRect.bottom - boardRect.top, tmphdc, boardRect.left, boardRect.top, SRCCOPY); if(saveDiagFlag) { - BITMAP b; int i, j=0, m, w, wb, fac=0; char pData[1000000]; + BITMAP b; int i, j=0, m, w, wb, fac=0; char *pData; BITMAPINFOHEADER bih; int color[16], nrColors=0; GetObject(bufferBitmap, sizeof(b), &b); - if(b.bmWidthBytes*b.bmHeight <= 990000) { + if(pData = malloc(b.bmWidthBytes*b.bmHeight + 10000)) { bih.biSize = sizeof(BITMAPINFOHEADER); bih.biWidth = b.bmWidth; bih.biHeight = b.bmHeight; @@ -3910,6 +3910,7 @@ HDCDrawPosition(HDC hdc, BOOLEAN repaint, Board board) // write bitmap data for(i=0; i