Magellan Linux

Contents of /trunk/ghostscript-gpl/patches/ghostscript-gpl-8.71-jbig2dec-nullderef.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1374 - (show annotations) (download)
Wed Jun 29 12:17:32 2011 UTC (12 years, 10 months ago) by niro
File size: 1787 byte(s)
added fedora patches
1 diff -up ghostscript-8.71/jbig2dec/jbig2_symbol_dict.c.jbig2dec-nullderef ghostscript-8.71/jbig2dec/jbig2_symbol_dict.c
2 --- ghostscript-8.71/jbig2dec/jbig2_symbol_dict.c.jbig2dec-nullderef 2009-05-29 07:48:44.000000000 +0100
3 +++ ghostscript-8.71/jbig2dec/jbig2_symbol_dict.c 2010-02-17 12:06:42.040614797 +0000
4 @@ -367,6 +367,11 @@ jbig2_decode_symbol_dict(Jbig2Ctx *ctx,
5 memcpy(region_params.gbat, params->sdat, sdat_bytes);
6
7 image = jbig2_image_new(ctx, SYMWIDTH, HCHEIGHT);
8 + if (image == NULL) {
9 + jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number,
10 + "failed to allocate image storage");
11 + return NULL;
12 + }
13
14 code = jbig2_decode_generic_region(ctx, segment, &region_params,
15 as, image, GB_stats);
16 @@ -517,6 +522,11 @@ jbig2_decode_symbol_dict(Jbig2Ctx *ctx,
17 ID, RDX, RDY);
18
19 image = jbig2_image_new(ctx, SYMWIDTH, HCHEIGHT);
20 + if (image == NULL) {
21 + jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number,
22 + "failed to allocate image storage");
23 + return NULL;
24 + }
25
26 /* Table 18 */
27 rparams.GRTEMPLATE = params->SDRTEMPLATE;
28 @@ -635,6 +645,16 @@ jbig2_decode_symbol_dict(Jbig2Ctx *ctx,
29 for (j = HCFIRSTSYM; j < NSYMSDECODED; j++) {
30 Jbig2Image *glyph;
31 glyph = jbig2_image_new(ctx, SDNEWSYMWIDTHS[j], HCHEIGHT);
32 + if (glyph == NULL) {
33 + jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number,
34 + "error allocating image storage for glyph");
35 + while (--j >= HCFIRSTSYM) {
36 + jbig2_image_release(ctx, SDNEWSYMS->glyphs[j]);
37 + SDNEWSYMS->glyphs[j] = NULL;
38 + }
39 + jbig2_image_release(ctx, image);
40 + return NULL;
41 + }
42 jbig2_image_compose(ctx, glyph, image,
43 -x, 0, JBIG2_COMPOSE_REPLACE);
44 x += SDNEWSYMWIDTHS[j];