]> granicus.if.org Git - libjpeg-turbo/commitdiff
Only access TJBUFSIZEYUV symbol if YUV encoding is enabled, and add 1 to the buffer...
authorDRC <dcommander@users.sourceforge.net>
Fri, 25 Feb 2011 01:14:46 +0000 (01:14 +0000)
committerDRC <dcommander@users.sourceforge.net>
Fri, 25 Feb 2011 01:14:46 +0000 (01:14 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@446 632fc199-4ca6-4c93-a231-07263d6284db

jpgtest.c

index e5147333ed0372d6f212bd19662527347a52bc9d..80ac42e488c38e605b55c226c72a6ca4a315d874 100644 (file)
--- a/jpgtest.c
+++ b/jpgtest.c
@@ -79,10 +79,9 @@ void dotest(unsigned char *srcbuf, int w, int h, int pf, int bu,
 
        flags |= _flags[pf];
        if(bu) flags |= TJ_BOTTOMUP;
-       if(yuv==YUVENCODE) flags |= TJ_YUV;
 
-       yuvsize=TJBUFSIZEYUV(w, h, jpegsub);
-       if((rgbbuf=(unsigned char *)malloc(max(yuvsize, pitch*h))) == NULL)
+       if(yuv==YUVENCODE) yuvsize=TJBUFSIZEYUV(w, h, jpegsub);
+       if((rgbbuf=(unsigned char *)malloc(max(yuvsize, pitch*h+1))) == NULL)
                _throwunix("allocating image buffer");
 
        if(!quiet)