Skip to content

Commit

Permalink
Fix PNG compression
Browse files Browse the repository at this point in the history
  • Loading branch information
aaaaaa123456789 committed Jan 22, 2022
1 parent 121d9be commit d15765a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Note: releases are listed from latest to oldest.
- Added some warning flags for debug builds, and cleared some warnings that would be raised by them
- Added and improved some safety checks that detect maliciously-crafted and other pathological files
- Added detection for empty GIF files (erroring out with `PLUM_ERR_NO_DATA` instead of `PLUM_ERR_INVALID_FILE_FORMAT`)
- Improved PNG compression by fixing a lookback bug in the compressor
- Some minor documentation updates and code cleanup

## Version 0.3 (10 January 2022)
Expand Down
2 changes: 1 addition & 1 deletion src/pngcompress.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ unsigned find_PNG_reference (const unsigned char * data, const uint16_t * refere

void append_PNG_reference (const unsigned char * restrict data, size_t offset, uint16_t * restrict references) {
uint_fast32_t key = compute_PNG_reference_key(data + offset) * (uint_fast32_t) PNG_MAX_LOOKBACK_COUNT;
memmove(references + key + 1, references + key, 7 * sizeof *references);
memmove(references + key + 1, references + key, (PNG_MAX_LOOKBACK_COUNT - 1) * sizeof *references);
references[key] = offset & 0x7fff;
}

Expand Down

0 comments on commit d15765a

Please sign in to comment.