View | Details | Raw Unified
Collapse All | Expand All

(-) tiff-3.7.4-orig/libtiff/tif_color.c (+5 lines)
 Lines 92-97    Link Here 
	Yg = TIFFmax(Yg, cielab->display.d_Y0G);
	Yg = TIFFmax(Yg, cielab->display.d_Y0G);
	Yb = TIFFmax(Yb, cielab->display.d_Y0B);
	Yb = TIFFmax(Yb, cielab->display.d_Y0B);
	/* Avoid overflow in case of wrong input values */
	Yr = TIFFmin(Yr, cielab->display.d_YCR);
	Yg = TIFFmin(Yg, cielab->display.d_YCG);
	Yb = TIFFmin(Yb, cielab->display.d_YCB);
	/* Turn luminosity to colour value. */
	/* Turn luminosity to colour value. */
	i = (int)((Yr - cielab->display.d_Y0R) / cielab->rstep);
	i = (int)((Yr - cielab->display.d_Y0R) / cielab->rstep);
	i = TIFFmin(cielab->range, i);
	i = TIFFmin(cielab->range, i);
(-) tiff-3.7.4-orig/libtiff/tif_dirread.c (-1 / +8 lines)
 Lines 784-796    Link Here 
	int w = TIFFDataWidth((TIFFDataType) dir->tdir_type);
	int w = TIFFDataWidth((TIFFDataType) dir->tdir_type);
	tsize_t cc = dir->tdir_count * w;
	tsize_t cc = dir->tdir_count * w;
	/* Check for overflow. */
	if (!dir->tdir_count || !w || cc / w != (tsize_t)dir->tdir_count)
		goto bad;
	if (!isMapped(tif)) {
	if (!isMapped(tif)) {
		if (!SeekOK(tif, dir->tdir_offset))
		if (!SeekOK(tif, dir->tdir_offset))
			goto bad;
			goto bad;
		if (!ReadOK(tif, cp, cc))
		if (!ReadOK(tif, cp, cc))
			goto bad;
			goto bad;
	} else {
	} else {
		if (dir->tdir_offset + cc > tif->tif_size)
		/* Check for overflow. */
		if ((tsize_t)dir->tdir_offset + cc < (tsize_t)dir->tdir_offset
		    || (tsize_t)dir->tdir_offset + cc < cc
		    || (tsize_t)dir->tdir_offset + cc > (tsize_t)tif->tif_size)
			goto bad;
			goto bad;
		_TIFFmemcpy(cp, tif->tif_base + dir->tdir_offset, cc);
		_TIFFmemcpy(cp, tif->tif_base + dir->tdir_offset, cc);
	}
	}
(-) tiff-3.7.4-orig/libtiff/tif_fax3.c (+6 lines)
 Lines 1059-1064    Link Here 
	if (tif->tif_data) {
	if (tif->tif_data) {
		Fax3CodecState* sp = DecoderState(tif);
		Fax3CodecState* sp = DecoderState(tif);
		assert (sp != 0);
		tif->tif_tagmethods.vgetfield = sp->b.vgetparent;
		tif->tif_tagmethods.vsetfield = sp->b.vsetparent;
		if (sp->runs)
		if (sp->runs)
			_TIFFfree(sp->runs);
			_TIFFfree(sp->runs);
		if (sp->refline)
		if (sp->refline)
 Lines 1119-1124    Link Here 
Fax3VSetField(TIFF* tif, ttag_t tag, va_list ap)
Fax3VSetField(TIFF* tif, ttag_t tag, va_list ap)
{
{
	Fax3BaseState* sp = Fax3State(tif);
	Fax3BaseState* sp = Fax3State(tif);
	assert (sp != 0);
	assert (sp->vsetparent != 0);
	switch (tag) {
	switch (tag) {
	case TIFFTAG_FAXMODE:
	case TIFFTAG_FAXMODE:
(-) tiff-3.7.4-orig/libtiff/tif_jpeg.c (-2 / +5 lines)
 Lines 1500-1514    Link Here 
static void
static void
JPEGCleanup(TIFF* tif)
JPEGCleanup(TIFF* tif)
{
{
	if (tif->tif_data) {
		JPEGState *sp = JState(tif);
		JPEGState *sp = JState(tif);
		assert (sp != 0);
		tif->tif_tagmethods.vgetfield = sp->vgetparent;
		tif->tif_tagmethods.vsetfield = sp->vsetparent;
                if( sp->cinfo_initialized )
                if( sp->cinfo_initialized )
                    TIFFjpeg_destroy(sp);	/* release libjpeg resources */
                    TIFFjpeg_destroy(sp);	/* release libjpeg resources */
		if (sp->jpegtables)		/* tag value */
		if (sp->jpegtables)		/* tag value */
			_TIFFfree(sp->jpegtables);
			_TIFFfree(sp->jpegtables);
		_TIFFfree(tif->tif_data);	/* release local state */
		_TIFFfree(tif->tif_data);	/* release local state */
		tif->tif_data = NULL;
		tif->tif_data = NULL;
	}
}
}
static int
static int
(-) tiff-3.7.4-orig/libtiff/tif_lzw.c (+2 lines)
 Lines 1002-1007    Link Here 
static void
static void
LZWCleanup(TIFF* tif)
LZWCleanup(TIFF* tif)
{
{
	(void)TIFFPredictorCleanup(tif);
	if (tif->tif_data) {
	if (tif->tif_data) {
		if (DecoderState(tif)->dec_codetab)
		if (DecoderState(tif)->dec_codetab)
			_TIFFfree(DecoderState(tif)->dec_codetab);
			_TIFFfree(DecoderState(tif)->dec_codetab);
(-) tiff-3.7.4-orig/libtiff/tif_pixarlog.c (-2 / +7 lines)
 Lines 1163-1169    Link Here 
{
{
	PixarLogState* sp = (PixarLogState*) tif->tif_data;
	PixarLogState* sp = (PixarLogState*) tif->tif_data;
	if (sp) {
	assert(sp != 0);
	
	(void)TIFFPredictorCleanup(tif);
	tif->tif_tagmethods.vgetfield = sp->vgetparent;
	tif->tif_tagmethods.vsetfield = sp->vsetparent;
		if (sp->FromLT2) _TIFFfree(sp->FromLT2);
		if (sp->FromLT2) _TIFFfree(sp->FromLT2);
		if (sp->From14) _TIFFfree(sp->From14);
		if (sp->From14) _TIFFfree(sp->From14);
		if (sp->From8) _TIFFfree(sp->From8);
		if (sp->From8) _TIFFfree(sp->From8);
 Lines 1180-1186    Link Here 
			_TIFFfree(sp->tbuf);
			_TIFFfree(sp->tbuf);
		_TIFFfree(sp);
		_TIFFfree(sp);
		tif->tif_data = NULL;
		tif->tif_data = NULL;
	}
}
}
static int
static int
(-) tiff-3.7.4-orig/libtiff/tif_predict.c (+24 lines)
 Lines 519-524    Link Here 
{
{
	TIFFPredictorState *sp = PredictorState(tif);
	TIFFPredictorState *sp = PredictorState(tif);
	assert(sp != NULL);
	assert(sp->vsetparent != NULL);
 
	switch (tag) {
	switch (tag) {
	case TIFFTAG_PREDICTOR:
	case TIFFTAG_PREDICTOR:
		sp->predictor = (uint16) va_arg(ap, int);
		sp->predictor = (uint16) va_arg(ap, int);
 Lines 536-541    Link Here 
{
{
	TIFFPredictorState *sp = PredictorState(tif);
	TIFFPredictorState *sp = PredictorState(tif);
	assert(sp != NULL);
	assert(sp->vgetparent != NULL);
	switch (tag) {
	switch (tag) {
	case TIFFTAG_PREDICTOR:
	case TIFFTAG_PREDICTOR:
		*va_arg(ap, uint16*) = sp->predictor;
		*va_arg(ap, uint16*) = sp->predictor;
 Lines 569-574    Link Here 
TIFFPredictorInit(TIFF* tif)
TIFFPredictorInit(TIFF* tif)
{
{
	TIFFPredictorState* sp = PredictorState(tif);
	TIFFPredictorState* sp = PredictorState(tif);
	
	assert(sp != NULL);
	/*
	/*
	 * Merge codec-specific tag information and
	 * Merge codec-specific tag information and
 Lines 595-598    Link Here 
	return 1;
	return 1;
}
}
int
TIFFPredictorCleanup(TIFF* tif)
{
	TIFFPredictorState* sp = PredictorState(tif);
	assert(sp != 0);
	tif->tif_tagmethods.vgetfield = sp->vgetparent;
	tif->tif_tagmethods.vsetfield = sp->vsetparent;
	tif->tif_tagmethods.printdir = sp->printdir;
	tif->tif_setupdecode = sp->setupdecode;
	tif->tif_setupencode = sp->setupencode;
	return 1;
}
/* vim: set ts=8 sts=8 sw=8 noet: */
/* vim: set ts=8 sts=8 sw=8 noet: */
(-) tiff-3.7.4-orig/libtiff/tif_predict.h (+1 lines)
 Lines 55-60    Link Here 
extern "C" {
extern "C" {
#endif
#endif
extern	int TIFFPredictorInit(TIFF*);
extern	int TIFFPredictorInit(TIFF*);
extern	int TIFFPredictorCleanup(TIFF*);
#if defined(__cplusplus)
#if defined(__cplusplus)
}
}
#endif
#endif
(-) tiff-3.7.4-orig/libtiff/tif_zip.c (-2 / +8 lines)
 Lines 249-255    Link Here 
ZIPCleanup(TIFF* tif)
ZIPCleanup(TIFF* tif)
{
{
	ZIPState* sp = ZState(tif);
	ZIPState* sp = ZState(tif);
	if (sp) {
	assert(sp != 0);
	(void)TIFFPredictorCleanup(tif);
	tif->tif_tagmethods.vgetfield = sp->vgetparent;
	tif->tif_tagmethods.vsetfield = sp->vsetparent;
		if (sp->state&ZSTATE_INIT) {
		if (sp->state&ZSTATE_INIT) {
			/* NB: avoid problems in the library */
			/* NB: avoid problems in the library */
			if (tif->tif_mode == O_RDONLY)
			if (tif->tif_mode == O_RDONLY)
 Lines 259-265    Link Here 
		}
		}
		_TIFFfree(sp);
		_TIFFfree(sp);
		tif->tif_data = NULL;
		tif->tif_data = NULL;
	}
}
}
static int
static int