Code:  jbig2_sd_release(Jbig2Ctx *ctx, Jbig2SymbolDict *dict)
 {
    int i;
 
     if (dict == NULL)
         return;
    for (i = 0; i < dict->n_symbols; i++)
        if (dict->glyphs[i])
            jbig2_image_release(ctx, dict->glyphs[i]);
    jbig2_free(ctx->allocator, dict->glyphs);
    jbig2_free(ctx->allocator, dict);
}

Vulnerability Type: Overflow
CWE ID: CWE-119
Summary: ghostscript before version 9.21 is vulnerable to a heap based buffer overflow that was found in the ghostscript jbig2_decode_gray_scale_image function which is used to decode halftone segments in a JBIG2 image. A document (PostScript or PDF) with an embedded, specially crafted, jbig2 image could trigger a segmentation fault in ghostscript.
Commit Message: 