-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
read_until_image_data doesn't seem to read until an IDAT #559
Comments
Are you sure you didn't entirely remove the IDAT chunks? The decoder can't know it has reached the image data until it sees a chunk with type=IDAT. If it hits the end of the input first it'll return a MissingImageData error. |
@fintelia Im doing this (basically the example usage for this crate):
But im not fully writing down all the data. If i do &data[..data.len()-1], it doesn't seem to work but there should at least be a single IDAT? Or am i misunderstanding an IDAT or something? I was just looking for a function that could parse all the ihdr chunks and pallete, everything not including the data. |
I'd have to look into the implementation of |
ok interesting thanks! |
I basically copied all the bytes of a png into another file (.pnle which is just smth i made up for a temp file). So technically up until the first IDAT chunk, all the metadata before should 100% be right.
I open the .pnle using
png::Decoder
to get a decoder object, then i calldecoder.read_info()
, which according to the spec and the src code, should read until the first IDAT. However, i truncate my .pnle a little bit towards the end, but all the metadata before the first IDAT is untouched. When theread_info
func is called, it errors out giving me aMissingImageData
inner error. Only, when i have the full entire png in the pnle does the read_info func complete.In the Decoder src,
read_info()
callsread_until_image_data()
and everytime it crashes saying that it's reached Decoded::ImageEnd already, which is only returned instream.rs
if it's found IEND.The text was updated successfully, but these errors were encountered: