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 files814
rhpco/cve-2018-16509Revision e27d583f36df
- ↑..Parent directory
- aes.c
- aes.h
- all-arch.mak
- append_l.com
- assert_.h
- bcc32.cfg
- bench.c
- bobbin.c
- bobbin.h
- catmake
- claptrap-impl.h
- claptrap-init.c
- claptrap-planar.c
- claptrap.c
- claptrap.h
- copy_one.com
- cp.bat
- cp.cmd
- ctype_.h
- dirent_.h
- dos_.h
- echogs.c
- errno_.h
- ets.c
- ets.h
- ets_tm.h
- expat.mak
- fapi_bs.mak
- fapi_ft.c
- fapibstm.c
- fapiufst.c
- fcntl_.h
- freetype.mak
- gconf.c
- gconf.h
- gdbflags.h
- gdebug.h
- gdevabuf.c
- gdevbbox.c
- gdevbbox.h
- gdevdbit.c
- gdevdcrd.c
- gdevdcrd.h
- gdevddrw.c
- gdevddrw.h
- gdevdevn.c
- gdevdevn.h
- gdevdevnprn.h
- gdevdflt.c
- gdevdgbr.c
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
ghostscript-9.22/base/gsnogc.c
C · 2,818 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.
*/
/* Use the normal ghostscript chunk allocator without support for garbage
collection or strings */
#include "gx.h"
#include "gsmdebug.h"
#include "gsnogc.h"
#include "gsstruct.h"
#include "gxalloc.h"
/* String allocations reduces to simple byte allocations. */
static byte *
nogc_alloc_string(gs_memory_t * mem, uint nbytes, client_name_t cname)
{
return gs_alloc_bytes(mem, nbytes, cname);
}
/* Free a string. */
static void
nogc_free_string(gs_memory_t * mem, byte * str, uint size, client_name_t cname)
{
gs_free_object(mem, str, cname);
}
static byte *
nogc_alloc_string_immovable(gs_memory_t * mem, uint nbytes, client_name_t cname)
{
return gs_alloc_bytes(mem, nbytes, cname);
}
static byte *
nogc_resize_string(gs_memory_t * mem, byte * data, uint old_num, uint new_num, client_name_t cname)
{
return gs_resize_object(mem, data, new_num, cname);
}
/*
* This procedure has the same API as the garbage collector used by the
* PostScript interpreter, but it is designed to be used in environments
* that don't need garbage collection and don't use save/restore. All it
* does is coalesce free blocks at the high end of the object area of each
* chunk, and free completely empty chunks.
*
*/
static void set_procs(gs_ref_memory_t *mem)
{
/* Change the allocator to use string freelists in the future. */
mem->procs.alloc_string = nogc_alloc_string;
mem->procs.free_string = nogc_free_string;
mem->procs.resize_string = nogc_resize_string;
mem->procs.alloc_string_immovable = nogc_alloc_string_immovable;
}
void
gs_nogc_reclaim(vm_spaces * pspaces, bool global)
{
int space;
gs_ref_memory_t *mem_prev = 0;
for (space = 0; space < countof(pspaces->memories.indexed); ++space) {
gs_ref_memory_t *mem = pspaces->memories.indexed[space];
if (mem == 0 || mem == mem_prev)
continue;
mem_prev = mem;
set_procs(mem);
gs_consolidate_free((gs_memory_t *)mem);
if (mem->stable_memory != (gs_memory_t *)mem &&
mem->stable_memory != 0
) {
set_procs((gs_ref_memory_t *)mem->stable_memory);
gs_consolidate_free((gs_memory_t *)mem->stable_memory);
}
}
}