handling of file with corrupt chunk size

Jose Colmenares <jcolmenares-GKI/[email protected]>
Newsgroups gmane.comp.graphics.png.devel
Message-ID <[email protected]>
Using valgring I'm getting an error when I try to load an image that has a
wrong length in the tEXt chunk. The length of the chunk is (wrongly) close
to a giga. 

 

I was going through the library (I'm using version 1.6.28) to modify it so
that it makes some kind of test to evaluate if that size is correct. For
example, it would make no sense if the size of a chunk is bigger than the
size of the file itself. But I could not find any reference to a file size
in the library.

 

I understand that libpng is used with streaming in mind. I want to make a
modification of the library and submit it to you for approval. What would
be the "libpng way" of doing a check like this?

 

Currently I added a set method where I set a parameter file_size (but
could stream_size, whatever) and in png_read_info the length of the chunk
is evaluated to be less than this size. But maybe this is not the best way
of doing this.

 

I really need to handle the cases when there is data corruption, and I
would like to submit the changes to libpng so that when we update the
library we don't have to go again through the changes we had made. And of
course, help the community.

Best,

 

Jose Colmenares.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
png-mng-implement mailing list
png-mng-implement-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.