pngme_book icon indicating copy to clipboard operation
pngme_book copied to clipboard

Should `is_valid` have an extra check for safe-to-copy bit?

Open jgao222 opened this issue 2 years ago • 0 comments

The PNG spec mentions a few things that should always be true for valid chunk types. It looks like tests do check for these, but the spec also says that:

The safe-to-copy bit will always be 0 for critical chunks.

I don't believe the current tests check for this, and the comment on the method stub for Chapter 1 doesn't mention it either.

Does a critical chunk with safe-to-copy bit set to 1 constitute an invalid chunk? If so, then the current test for is_valid should fail. Adhering strictly to the instructions, not allowing chunk types of this form to be constructed would result in any test cases with the chunk type "RuSt" panicking since they call unwrap().

jgao222 avatar Aug 04 '22 00:08 jgao222