Comments (3)
The PNG decoder still loops around "short read" in one place.
Can you elaborate on (1) where is this one place and (2) why this is a problem?
If the answer to (1) is in decoder.do_decode_frame
line 1248 then decoder.decode_frame
should 'catch' it and turn it into "truncated input".
DecodeImage0 doesn't reflect this change (no DecodeImage_UnexpectedEndOfFile as far as I can tell).
Yeah, DecodeImage_UnexpectedEndOfFile
ought to be unreachable now. We could probably remove it in v0.4.
All decoders have their own version of this error, is that necessary?
Go isn't Wuffs, but in the Go standard library, we returned a common error (io.ErrUnexpectedEOF
) instead of each image decoder having their own version of this error. This was apparently confusing / surprising, so it's the other way round in Wuffs.
from wuffs.
Can you elaborate on (1) where is this one place and (2) why this is a problem?
https://github.com/google/wuffs/blob/main/std/png/decode_png.wuffs#L1237
Inconsistency. I haven't retested what actually happens, I've just reread the code.
This was apparently confusing / surprising, so it's the other way round in Wuffs.
This particular argument doesn't convince me. The thread is about people trying to receive as much of an image as they can, and dealing with the possibility of receiving an error (warning) at the same time.
from wuffs.
https://github.com/google/wuffs/blob/main/std/png/decode_png.wuffs#L1237
OK that (line 1237) rolls into line 1248 that I referenced above. I suppose we could make line 1248 return "#truncated input"
directly, which would be a little cleaner. As I said, though, decoder.decode_frame
should already 'catch' "$short read"
, so it shouldn't make a difference, in practice.
This particular argument doesn't convince me.
If you're not convinced then we'll agree to disagree. I'm just telling you why it's the way it is.
The thread is about people trying to receive as much of an image as they can, and dealing with the possibility of receiving an error (warning) at the same time.
There's two concerns in that thread. One is about trying to receive as much of an image as they can, as you said. Two is about what error you get when it's truncated (a generic io
error versus an image-format-specific jpeg
error) which is relevant to your "All decoders have their own version of this error, is that necessary?" in the OP. A quote from that thread: "How do I know that io.ErrUnexpectedEOF
has anything to do with "wrong" JPEGs?"
from wuffs.
Related Issues (20)
- bang insert directives depend on linux line endings
- print-image-metadata script can go into an infinite loop
- Slow f64 parsing HOT 13
- RGB/BGR 16 bit treated like RGBA/BGRA? HOT 1
- OSS-Fuzz issue 59018 HOT 1
- [JPEG] unsupported DQT after SOF markers HOT 1
- OSS-Fuzz issue 59182 HOT 1
- OSS-Fuzz issue 59540 HOT 1
- OSS-Fuzz issue 59966 HOT 1
- A question regarding auxiliary C++ API HOT 4
- What is the status of version 0.3? HOT 3
- Empty slice manipulation triggers UBSAN by offsetting from a null pointer. HOT 2
- error: conversion to ‘uint32_t’ {aka ‘unsigned int’} from ‘int’ may change the sign of the result HOT 3
- Audio and video codecs HOT 6
- convert wuffs asserts into back-end asserts HOT 2
- Security Policy violation Binary Artifacts
- OSS-Fuzz issue 47846 HOT 1
- lib/readerat: delayed invalid seek offset detected? HOT 1
- example/zcat loops forever on short input files HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wuffs.