Skip to content

check on PLTE: duplicate & sBIT: out of place #275

@ElinorCoding

Description

@ElinorCoding

check on PLTE: duplicate & sBIT: out of place

version

commit_hash = adc9439

description

Hi,I found that given the following png(maybe not a valid png file), libspng(commit_hash=adc9439) could successfully parse it, while libpng reports errors and warnings: libpng warning: sBIT: out of place, libpng error: PLTE: duplicate.

Meanwhile, I tried an older version of libspng (commit_hash=2a32ffa), and found that the old version does not consider the file as parsable.

I'm not sure if something introduced in a particular commit caused this issue to occur.

reproduction steps

The testcase is attached. You can use the following command to reproduce the issue:

Image

If you need the specific parsing code to reproduce it, it can be easily reproduced from the zip below,because The compilation commands have essentially been scripted.

bugs_report.tar.gz

- prepare the path and sourse

Extract the compressed package bugs_report.tar.gz to a directory, referred to as yourpath2. Modify the file compile_commit_hash.sh and the Makefile to replace yourpath with your actual working directory.

Then, create the directories src/ and build/ in the working directory yourpath . In the src directory, execute the command https://github.com/randy408/libspng to clone the repository.

Finally, modify the file compile_commit_hash.sh to replace yourpath2 with the directory path where you extracted the compressed package.

- compile and test

In the yourpath2 directory, execute the commands:

./compile_commit_hash.sh adc9439

to compile the new versions of spng and to generate the executable files for testing

In the yourpath2 directory, execute the commands:

./compile_commit_hash.sh 2a32ffa

to compile the old versions of spng and to generate the executable files for testing.

In the yourpath2 directory, execute the commands:

./spng_Parse_adc9439 testcase.png

and

./spng_Parse_2a32ffa testcase.png

to observe the different behaviors of libspng on the same testcase.

Expected behavior

The testcase.png : Image should not be parsed successfully in the newest libspng version.

Platform

  • OS: ubuntu22.04.05 (kernel: Linux 6.10.11)
  • Compiler: clang 14.0.0
  • Architecture: x86_64

Additional context

I also test it on libpng , which shows:

libpng warning: sBIT: out of place
libpng error: PLTE: duplicate

and its ret is not 0.

Thanks in advance.
Elinor

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions