Skip to content

Commit

Permalink
Increase lookback length for PNG to improve compression
Browse files Browse the repository at this point in the history
  • Loading branch information
aaaaaa123456789 committed Jan 24, 2022
1 parent 294423c commit e3f47d1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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
- Improved PNG compression by fixing a lookback bug in the compressor and adjusting the lookback length
- Added and documented a restriction requiring `size_t` to be at least 32 bits wide
- Some minor documentation updates and code cleanup

Expand Down
2 changes: 1 addition & 1 deletion src/pngcompress.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "proto.h"

#define PNG_MAX_LOOKBACK_COUNT 16
#define PNG_MAX_LOOKBACK_COUNT 64

unsigned char * compress_PNG_data (struct context * context, const unsigned char * restrict data, size_t size, size_t extra, size_t * restrict output_size) {
// extra is the number of zero bytes inserted before the compressed data; they are not included in the size
Expand Down

0 comments on commit e3f47d1

Please sign in to comment.