diff options
-rw-r--r-- | glib/poppler-page.cc | 2 | ||||
-rw-r--r-- | goo/gmem.cc | 22 | ||||
-rw-r--r-- | goo/gmem.h | 2 | ||||
-rw-r--r-- | poppler/ArthurOutputDev.cc | 4 | ||||
-rw-r--r-- | poppler/CairoOutputDev.cc | 14 | ||||
-rw-r--r-- | poppler/GfxState.cc | 8 | ||||
-rw-r--r-- | poppler/PSOutputDev.cc | 6 | ||||
-rw-r--r-- | poppler/SplashOutputDev.cc | 20 | ||||
-rw-r--r-- | splash/Splash.cc | 8 | ||||
-rw-r--r-- | splash/SplashBitmap.cc | 6 | ||||
-rw-r--r-- | splash/SplashFTFont.cc | 2 |
11 files changed, 59 insertions, 35 deletions
diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc index f1dd1336..225c97b2 100644 --- a/glib/poppler-page.cc +++ b/glib/poppler-page.cc @@ -313,13 +313,13 @@ poppler_page_prepare_output_dev (PopplerPage *page, cairo_width = (int) ceil(width * scale); cairo_height = (int) ceil(height * scale); output_dev = page->document->output_dev; cairo_rowstride = cairo_width * 4; - cairo_data = (guchar *) gmalloc (cairo_height * cairo_rowstride); + cairo_data = (guchar *) gmallocn (cairo_height, cairo_rowstride); if (transparent) memset (cairo_data, 0x00, cairo_height * cairo_rowstride); else memset (cairo_data, 0xff, cairo_height * cairo_rowstride); surface = cairo_image_surface_create_for_data(cairo_data, diff --git a/goo/gmem.cc b/goo/gmem.cc index 298d5ddb..af3e19ef 100644 --- a/goo/gmem.cc +++ b/goo/gmem.cc @@ -213,12 +213,34 @@ void *gmallocn(int nObjs, int objSize) GMEM_EXCEP { } void *gmallocn_checkoverflow(int nObjs, int objSize) GMEM_EXCEP { return gmallocn(nObjs, objSize, true); } +inline static void *gmallocn3(int a, int b, int c, bool checkoverflow) GMEM_EXCEP { + int n = a * b; + if (b <= 0 || a < 0 || a >= INT_MAX / b) { +#if USE_EXCEPTIONS + throw GMemException(); +#else + fprintf(stderr, "Bogus memory allocation size\n"); + if (checkoverflow) return NULL; + else exit(1); +#endif + } + return gmallocn(n, c, checkoverflow); +} + +void *gmallocn3(int a, int b, int c) GMEM_EXCEP { + return gmallocn3(a, b, c, false); +} + +void *gmallocn3_checkoverflow(int a, int b, int c) GMEM_EXCEP { + return gmallocn3(a, b, c, true); +} + inline static void *greallocn(void *p, int nObjs, int objSize, bool checkoverflow) GMEM_EXCEP { int n; if (nObjs == 0) { if (p) { gfree(p); @@ -69,12 +69,14 @@ extern void *grealloc_checkoverflow(size_t size) GMEM_EXCEP; * doesn't overflow an int. * The gmallocn_checkoverflow variant returns NULL instead of exiting * the application if a overflow is detected */ extern void *gmallocn(int nObjs, int objSize) GMEM_EXCEP; extern void *gmallocn_checkoverflow(int nObjs, int objSize) GMEM_EXCEP; +extern void *gmallocn3(int a, int b, int c) GMEM_EXCEP; +extern void *gmallocn3_checkoverflow(int a, int b, int c) GMEM_EXCEP; extern void *greallocn(void *p, int nObjs, int objSize) GMEM_EXCEP; extern void *greallocn_checkoverflow(void *p, int nObjs, int objSize) GMEM_EXCEP; /* * Same as free, but checks for and ignores NULL pointers. */ diff --git a/poppler/ArthurOutputDev.cc b/poppler/ArthurOutputDev.cc index 4f6a1d0f..fe562fe3 100644 --- a/poppler/ArthurOutputDev.cc +++ b/poppler/ArthurOutputDev.cc @@ -11,13 +11,13 @@ // Modified under the Poppler project - http://poppler.freedesktop.org // // All changes made under the Poppler project to this file are licensed // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <bradh@frogmouth.net> -// Copyright (C) 2005-2008 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2005-2009 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2008 Pino Toscano <pino@kde.org> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git // //======================================================================== @@ -748,13 +748,13 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, Guchar *pix; int i; double *ctm; QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width, colorMap->getNumPixelComps(), colorMap->getBits()); imgStr->reset(); diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc index 91e1d045..98adb7cb 100644 --- a/poppler/CairoOutputDev.cc +++ b/poppler/CairoOutputDev.cc @@ -13,13 +13,13 @@ // // All changes made under the Poppler project to this file are licensed // under GPL version 2 or later // // Copyright (C) 2005-2008 Jeff Muizelaar <jeff@infidigm.net> // Copyright (C) 2005, 2006 Kristian Høgsberg <krh@redhat.com> -// Copyright (C) 2005 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2005, 2009 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2005 Nickolay V. Shmyrev <nshmyrev@yandex.ru> // Copyright (C) 2006-2008 Carlos Garcia Campos <carlosgc@gnome.org> // Copyright (C) 2008 Carl Worth <cworth@cworth.org> // Copyright (C) 2008 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2008 Michael Vrable <mvrable@cs.ucsd.edu> // Copyright (C) 2008 Chris Wilson <chris@chris-wilson.co.uk> @@ -608,13 +608,13 @@ void CairoOutputDev::beginString(GfxState *state, GooString *s) if (needFontUpdate) updateFont(state); if (!currentFont) return; - glyphs = (cairo_glyph_t *) gmalloc (len * sizeof (cairo_glyph_t)); + glyphs = (cairo_glyph_t *) gmallocn (len, sizeof (cairo_glyph_t)); glyphCount = 0; } void CairoOutputDev::drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, @@ -1458,13 +1458,13 @@ void CairoOutputDev::drawMaskedImage(GfxState *state, Object *ref, ImageStream *maskImgStr; maskImgStr = new ImageStream(maskStr, maskWidth, 1, 1); maskImgStr->reset(); int row_stride = (maskWidth + 3) & ~3; unsigned char *maskBuffer; - maskBuffer = (unsigned char *)gmalloc (row_stride * maskHeight); + maskBuffer = (unsigned char *)gmallocn (row_stride, maskHeight); unsigned char *maskDest; cairo_surface_t *maskImage; cairo_pattern_t *maskPattern; Guchar *pix; int x, y; @@ -1494,13 +1494,13 @@ void CairoOutputDev::drawMaskedImage(GfxState *state, Object *ref, cairo_surface_t *image; cairo_pattern_t *pattern; ImageStream *imgStr; cairo_matrix_t matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3 (width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width, colorMap->getNumPixelComps(), colorMap->getBits()); imgStr->reset(); @@ -1583,13 +1583,13 @@ void CairoOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *s maskColorMap->getNumPixelComps(), maskColorMap->getBits()); maskImgStr->reset(); int row_stride = (maskWidth + 3) & ~3; unsigned char *maskBuffer; - maskBuffer = (unsigned char *)gmalloc (row_stride * maskHeight); + maskBuffer = (unsigned char *)gmallocn (row_stride, maskHeight); unsigned char *maskDest; cairo_surface_t *maskImage; cairo_pattern_t *maskPattern; Guchar *pix; int y; for (y = 0; y < maskHeight; y++) { @@ -1610,13 +1610,13 @@ void CairoOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *s cairo_pattern_t *pattern; ImageStream *imgStr; cairo_matrix_t matrix; cairo_matrix_t maskMatrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3 (width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width, colorMap->getNumPixelComps(), colorMap->getBits()); imgStr->reset(); @@ -1702,13 +1702,13 @@ void CairoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, ImageStream *imgStr; Guchar *pix; int i; cairo_matrix_t matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3 (width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width, colorMap->getNumPixelComps(), colorMap->getBits()); imgStr->reset(); diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc index 8fc8feb5..1ca32895 100644 --- a/poppler/GfxState.cc +++ b/poppler/GfxState.cc @@ -1846,13 +1846,13 @@ void GfxIndexedColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) { void GfxIndexedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length) { Guchar *line; int i, j, n; n = base->getNComps(); - line = (Guchar *) gmalloc (length * n); + line = (Guchar *) gmallocn (length, n); for (i = 0; i < length; i++) for (j = 0; j < n; j++) line[i * n + j] = lookup[in[i] * n + j]; base->getRGBLine(line, out, length); @@ -4069,13 +4069,13 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode, indexedCS = (GfxIndexedColorSpace *)colorSpace; colorSpace2 = indexedCS->getBase(); indexHigh = indexedCS->getIndexHigh(); nComps2 = colorSpace2->getNComps(); lookup2 = indexedCS->getLookup(); colorSpace2->getDefaultRanges(x, y, indexHigh); - byte_lookup = (Guchar *)gmalloc ((maxPixel + 1) * nComps2); + byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2); for (k = 0; k < nComps2; ++k) { lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1, sizeof(GfxColorComp)); for (i = 0; i <= maxPixel; ++i) { j = (int)(decodeLow[0] + (i * decodeRange[0]) / maxPixel + 0.5); if (j < 0) { @@ -4217,13 +4217,13 @@ void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) { int i, j; Guchar *inp, *tmp_line; switch (colorSpace->getMode()) { case csIndexed: case csSeparation: - tmp_line = (Guchar *) gmalloc (length * nComps2); + tmp_line = (Guchar *) gmallocn (length, nComps2); for (i = 0; i < length; i++) { for (j = 0; j < nComps2; j++) { tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j]; } } colorSpace2->getGrayLine(tmp_line, out, length); @@ -4247,13 +4247,13 @@ void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) { int i, j; Guchar *inp, *tmp_line; switch (colorSpace->getMode()) { case csIndexed: case csSeparation: - tmp_line = (Guchar *) gmalloc (length * nComps2); + tmp_line = (Guchar *) gmallocn (length, nComps2); for (i = 0; i < length; i++) { for (j = 0; j < nComps2; j++) { tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j]; } } colorSpace2->getRGBLine(tmp_line, out, length); diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc index 9477762e..f02bd98a 100644 --- a/poppler/PSOutputDev.cc +++ b/poppler/PSOutputDev.cc @@ -12,13 +12,13 @@ // // All changes made under the Poppler project to this file are licensed // under GPL version 2 or later // // Copyright (C) 2005 Martin Kretzschmar <martink@gnome.org> // Copyright (C) 2005, 2006 Kristian Høgsberg <krh@redhat.com> -// Copyright (C) 2006-2008 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2006-2009 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2006 Jeff Muizelaar <jeff@infidigm.net> // Copyright (C) 2007, 2008 Brad Hards <bradh@kde.org> // Copyright (C) 2008 Koji Otani <sho@bbr.jp> // Copyright (C) 2008 Hib Eris <hib@hiberis.nl> // // To see a description of the changes please see the Changelog file that @@ -2321,13 +2321,13 @@ GooString *PSOutputDev::setupExternalCIDTrueTypeFont(GfxFont *font, GooString *f embFontList->append("\n"); // convert it to a CID type2 font if ((ffTT = FoFiTrueType::load(fileName->getCString(), faceIndex))) { int n = ((GfxCIDFont *)font)->getCIDToGIDLen(); if (n) { - codeToGID = (Gushort *)gmalloc(n * sizeof(Gushort)); + codeToGID = (Gushort *)gmallocn(n, sizeof(Gushort)); memcpy(codeToGID, ((GfxCIDFont *)font)->getCIDToGID(), n * sizeof(Gushort)); } else { codeToGID = ((GfxCIDFont *)font)->getCodeToGIDMap(ffTT, &n); } if (globalParams->getPSLevel() >= psLevel3) { // Level 3: use a CID font @@ -4500,13 +4500,13 @@ void PSOutputDev::doImageL1Sep(GfxImageColorMap *colorMap, // width, height, matrix, bits per component writePSFmt("{0:d} {1:d} 8 [{2:d} 0 0 {3:d} 0 {4:d}] pdfIm1Sep\n", width, height, width, -height, height); // allocate a line buffer - lineBuf = (Guchar *)gmalloc(4 * width); + lineBuf = (Guchar *)gmallocn(width, 4); // set up to process the data stream imgStr = new ImageStream(str, width, colorMap->getNumPixelComps(), colorMap->getBits()); imgStr->reset(); diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index 8d4758a6..dc4661a9 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -12,13 +12,13 @@ // // All changes made under the Poppler project to this file are licensed // under GPL version 2 or later // // Copyright (C) 2005 Takashi Iwai <tiwai@suse.de> // Copyright (C) 2006 Stefan Schweizer <genstef@gentoo.org> -// Copyright (C) 2006-2008 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2006-2009 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2006 Krzysztof Kowalczyk <kkowalczyk@gmail.com> // Copyright (C) 2006 Scott Turner <scotty1024@mac.com> // Copyright (C) 2007 Koji Otani <sho@bbr.jp> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -2010,35 +2010,35 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, colorMap->getGray(&pix, &gray); imgData.lookup[i] = colToByte(gray); } break; case splashModeRGB8: case splashModeBGR8: - imgData.lookup = (SplashColorPtr)gmalloc(3 * n); + imgData.lookup = (SplashColorPtr)gmallocn(n, 3); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getRGB(&pix, &rgb); imgData.lookup[3*i] = colToByte(rgb.r); imgData.lookup[3*i+1] = colToByte(rgb.g); imgData.lookup[3*i+2] = colToByte(rgb.b); } break; case splashModeXBGR8: - imgData.lookup = (SplashColorPtr)gmalloc(4 * n); + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getRGB(&pix, &rgb); imgData.lookup[4*i] = colToByte(rgb.r); imgData.lookup[4*i+1] = colToByte(rgb.g); imgData.lookup[4*i+2] = colToByte(rgb.b); imgData.lookup[4*i+3] = 255; } break; #if SPLASH_CMYK case splashModeCMYK8: - imgData.lookup = (SplashColorPtr)gmalloc(4 * n); + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getCMYK(&pix, &cmyk); imgData.lookup[4*i] = colToByte(cmyk.c); imgData.lookup[4*i+1] = colToByte(cmyk.m); imgData.lookup[4*i+2] = colToByte(cmyk.y); @@ -2275,35 +2275,35 @@ void SplashOutputDev::drawMaskedImage(GfxState *state, Object *ref, colorMap->getGray(&pix, &gray); imgData.lookup[i] = colToByte(gray); } break; case splashModeRGB8: case splashModeBGR8: - imgData.lookup = (SplashColorPtr)gmalloc(3 * n); + imgData.lookup = (SplashColorPtr)gmallocn(n, 3); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getRGB(&pix, &rgb); imgData.lookup[3*i] = colToByte(rgb.r); imgData.lookup[3*i+1] = colToByte(rgb.g); imgData.lookup[3*i+2] = colToByte(rgb.b); } break; case splashModeXBGR8: - imgData.lookup = (SplashColorPtr)gmalloc(4 * n); + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getRGB(&pix, &rgb); imgData.lookup[4*i] = colToByte(rgb.r); imgData.lookup[4*i+1] = colToByte(rgb.g); imgData.lookup[4*i+2] = colToByte(rgb.b); imgData.lookup[4*i+3] = 255; } break; #if SPLASH_CMYK case splashModeCMYK8: - imgData.lookup = (SplashColorPtr)gmalloc(4 * n); + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getCMYK(&pix, &cmyk); imgData.lookup[4*i] = colToByte(cmyk.c); imgData.lookup[4*i+1] = colToByte(cmyk.m); imgData.lookup[4*i+2] = colToByte(cmyk.y); @@ -2418,35 +2418,35 @@ void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, colorMap->getGray(&pix, &gray); imgData.lookup[i] = colToByte(gray); } break; case splashModeRGB8: case splashModeBGR8: - imgData.lookup = (SplashColorPtr)gmalloc(3 * n); + imgData.lookup = (SplashColorPtr)gmallocn(n, 3); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getRGB(&pix, &rgb); imgData.lookup[3*i] = colToByte(rgb.r); imgData.lookup[3*i+1] = colToByte(rgb.g); imgData.lookup[3*i+2] = colToByte(rgb.b); } break; case splashModeXBGR8: - imgData.lookup = (SplashColorPtr)gmalloc(4 * n); + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getRGB(&pix, &rgb); imgData.lookup[4*i] = colToByte(rgb.r); imgData.lookup[4*i+1] = colToByte(rgb.g); imgData.lookup[4*i+2] = colToByte(rgb.b); imgData.lookup[4*i+3] = 255; } break; #if SPLASH_CMYK case splashModeCMYK8: - imgData.lookup = (SplashColorPtr)gmalloc(4 * n); + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getCMYK(&pix, &cmyk); imgData.lookup[4*i] = colToByte(cmyk.c); imgData.lookup[4*i+1] = colToByte(cmyk.m); imgData.lookup[4*i+2] = colToByte(cmyk.y); diff --git a/splash/Splash.cc b/splash/Splash.cc index c93ef408..a1deb854 100644 --- a/splash/Splash.cc +++ b/splash/Splash.cc @@ -8,13 +8,13 @@ // // Modified under the Poppler project - http://poppler.freedesktop.org // // All changes made under the Poppler project to this file are licensed // under GPL version 2 or later // -// Copyright (C) 2005-2008 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2005-2009 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2005 Marco Pesenti Gritti <mpg@redhat.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git // //======================================================================== @@ -1998,13 +1998,13 @@ SplashError Splash::fillImageMask(SplashImageMaskSource src, void *srcData, yp = h / scaledHeight; yq = h % scaledHeight; xp = w / scaledWidth; xq = w % scaledWidth; // allocate pixel buffer - pixBuf = (SplashColorPtr)gmalloc((yp + 1) * w); + pixBuf = (SplashColorPtr)gmallocn((yp + 1), w); // initialize the pixel pipe pipeInit(&pipe, 0, 0, state->fillPattern, NULL, state->fillAlpha, gTrue, gFalse); if (vectorAntialias) { drawAAPixelInit(); @@ -2298,15 +2298,15 @@ SplashError Splash::drawImage(SplashImageSource src, void *srcData, yp = h / scaledHeight; yq = h % scaledHeight; xp = w / scaledWidth; xq = w % scaledWidth; // allocate pixel buffers - colorBuf = (SplashColorPtr)gmalloc((yp + 1) * w * nComps); + colorBuf = (SplashColorPtr)gmallocn3((yp + 1), w, nComps); if (srcAlpha) { - alphaBuf = (Guchar *)gmalloc((yp + 1) * w); + alphaBuf = (Guchar *)gmallocn((yp + 1), w); } else { alphaBuf = NULL; } pixAcc0 = pixAcc1 = pixAcc2 = 0; // make gcc happy #if SPLASH_CMYK diff --git a/splash/SplashBitmap.cc b/splash/SplashBitmap.cc index 97d622cf..6cf2aea9 100644 --- a/splash/SplashBitmap.cc +++ b/splash/SplashBitmap.cc @@ -8,13 +8,13 @@ // // Modified under the Poppler project - http://poppler.freedesktop.org // // All changes made under the Poppler project to this file are licensed // under GPL version 2 or later // -// Copyright (C) 2006 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2006, 2009 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2007 Ilmari Heikkinen <ilmari.heikkinen@gmail.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git // //======================================================================== @@ -59,19 +59,19 @@ SplashBitmap::SplashBitmap(int widthA, int heightA, int rowPad, rowSize = width * 4; break; #endif } rowSize += rowPad - 1; rowSize -= rowSize % rowPad; - data = (SplashColorPtr)gmalloc(rowSize * height); + data = (SplashColorPtr)gmallocn(rowSize, height); if (!topDown) { data += (height - 1) * rowSize; rowSize = -rowSize; } if (alphaA) { - alpha = (Guchar *)gmalloc(width * height); + alpha = (Guchar *)gmallocn(width, height); } else { alpha = NULL; } } diff --git a/splash/SplashFTFont.cc b/splash/SplashFTFont.cc index 0039feb6..c3b298af 100644 --- a/splash/SplashFTFont.cc +++ b/splash/SplashFTFont.cc @@ -240,13 +240,13 @@ GBool SplashFTFont::makeGlyph(int c, int xFrac, int yFrac, bitmap->aa = aa; if (aa) { rowSize = bitmap->w; } else { rowSize = (bitmap->w + 7) >> 3; } - bitmap->data = (Guchar *)gmalloc(rowSize * bitmap->h); + bitmap->data = (Guchar *)gmallocn(rowSize, bitmap->h); bitmap->freeData = gTrue; for (i = 0, p = bitmap->data, q = slot->bitmap.buffer; i < bitmap->h; ++i, p += rowSize, q += slot->bitmap.pitch) { memcpy(p, q, rowSize); } |