Exploit databaseDownload repository ZIP
GH-e9c4abed697d446a44e1f9202351d16d
rhpco/cve-2018-16509
Sources for CVE-2018-16509
9 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files57
rhpco/cve-2018-16509Revision e27d583f36df
- ↑..Parent directory
- .gitignore
- CHANGES
- COPYING
- LICENSE
- Makefile.am
- Makefile.unix
- README
- annex-h.jbig2
- autogen.sh
- config_win32.h
- configure.ac
- getopt.c
- getopt.h
- getopt1.c
- jbig2.c
- jbig2.h
- jbig2_arith.c
- jbig2_arith.h
- jbig2_arith_iaid.c
- jbig2_arith_iaid.h
- jbig2_arith_int.c
- jbig2_arith_int.h
- jbig2_generic.c
- jbig2_generic.h
- jbig2_halftone.c
- jbig2_halftone.h
- jbig2_huffman.c
- jbig2_huffman.h
- jbig2_hufftab.h
- jbig2_image.c
- jbig2_image.h
- jbig2_image_pbm.c
- jbig2_image_png.c
- jbig2_metadata.c
- jbig2_metadata.h
- jbig2_mmr.c
- jbig2_mmr.h
- jbig2_page.c
- jbig2_priv.h
- jbig2_refinement.c
- jbig2_segment.c
- jbig2_symbol_dict.c
- jbig2_symbol_dict.h
- jbig2_text.c
- jbig2_text.h
- jbig2dec.1
- jbig2dec.c
- memcmp.c
- memento.c
- memento.h
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
ghostscript-9.22/jbig2dec/jbig2_arith_iaid.c
C · 2,569 bytes/* Copyright (C) 2001-2012 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
implied.
This software is distributed under license and may not be copied,
modified or distributed except as expressly authorized under the terms
of the license contained in the file LICENSE in this distribution.
Refer to licensing information at http://www.artifex.com or contact
Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael,
CA 94903, U.S.A., +1(415)492-9861, for further information.
*/
/*
jbig2dec
*/
/* Annex A.3 */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "os_types.h"
#include <stddef.h>
#include <string.h> /* memset() */
#ifdef VERBOSE
#include <stdio.h> /* for debug printing only */
#endif
#include "jbig2.h"
#include "jbig2_priv.h"
#include "jbig2_arith.h"
#include "jbig2_arith_iaid.h"
struct _Jbig2ArithIaidCtx {
int SBSYMCODELEN;
Jbig2ArithCx *IAIDx;
};
Jbig2ArithIaidCtx *
jbig2_arith_iaid_ctx_new(Jbig2Ctx *ctx, int SBSYMCODELEN)
{
Jbig2ArithIaidCtx *result = jbig2_new(ctx, Jbig2ArithIaidCtx, 1);
int ctx_size = 1 << SBSYMCODELEN;
if (result == NULL) {
jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to allocate storage in jbig2_arith_iaid_ctx_new");
return result;
}
result->SBSYMCODELEN = SBSYMCODELEN;
result->IAIDx = jbig2_new(ctx, Jbig2ArithCx, ctx_size);
if (result->IAIDx != NULL) {
memset(result->IAIDx, 0, ctx_size);
} else {
jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to allocate symbol ID storage in jbig2_arith_iaid_ctx_new");
}
return result;
}
/* A.3 */
/* Return value: -1 on error, 0 on normal value */
int
jbig2_arith_iaid_decode(Jbig2ArithIaidCtx *ctx, Jbig2ArithState *as, int32_t *p_result)
{
Jbig2ArithCx *IAIDx = ctx->IAIDx;
int SBSYMCODELEN = ctx->SBSYMCODELEN;
int PREV = 1;
int D;
int i;
/* A.3 (2) */
for (i = 0; i < SBSYMCODELEN; i++) {
D = jbig2_arith_decode(as, &IAIDx[PREV]);
#ifdef VERBOSE
fprintf(stderr, "IAID%x: D = %d\n", PREV, D);
#endif
PREV = (PREV << 1) | D;
}
/* A.3 (3) */
PREV -= 1 << SBSYMCODELEN;
#ifdef VERBOSE
fprintf(stderr, "IAID result: %d\n", PREV);
#endif
*p_result = PREV;
return 0;
}
void
jbig2_arith_iaid_ctx_free(Jbig2Ctx *ctx, Jbig2ArithIaidCtx *iax)
{
if (iax != NULL) {
jbig2_free(ctx->allocator, iax->IAIDx);
jbig2_free(ctx->allocator, iax);
}
}