Bug 691568 - closedctd function has a bug
Summary: closedctd function has a bug
Status: RESOLVED WORKSFORME
Alias: None
Product: MuPDF
Classification: Unclassified
Component: fitz (show other bugs)
Version: unspecified
Hardware: PC Windows XP
: P4 normal
Assignee: Tor Andersson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-20 15:15 UTC by akay
Modified: 2010-08-23 13:23 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description akay 2010-08-20 15:15:23 UTC
on file filt_dctd.c
Line 182,
function closedctd(fz_stream *stm)

	if (state->init)
		jpeg_finish_decompress(&state->cinfo);
	state->chain->rp = state->chain->wp - state->cinfo.src->bytes_in_buffer;
	jpeg_destroy_decompress(&state->cinfo);

I think this will modify to:
	if (state->init)
	{
		jpeg_finish_decompress(&state->cinfo);
		state->chain->rp = state->chain->wp - state->cinfo.src->bytes_in_buffer;
		jpeg_destroy_decompress(&state->cinfo);
	}

Because if the state did not init,if you call jpeg_destroy_decompress(&state->cinfo);
will cause fatal error.

Please check.
Comment 1 Tor Andersson 2010-08-23 13:23:45 UTC
jpeg_create_decompress is always called. If jpeg_read_header fails then closedct will be called with state->init set to false. In this case, we want to call jpeg_destroy_compress but not jpeg_finish_decompress (this is why we have the state->init flag).