Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libwebp for openSUSE:Factory checked in at 2023-09-17 19:28:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libwebp (Old) and /work/SRC/openSUSE:Factory/.libwebp.new.1766 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libwebp" Sun Sep 17 19:28:52 2023 rev:38 rq:1111545 version:1.3.2 Changes: -------- --- /work/SRC/openSUSE:Factory/libwebp/libwebp.changes 2023-09-13 20:43:33.751944253 +0200 +++ /work/SRC/openSUSE:Factory/.libwebp.new.1766/libwebp.changes 2023-09-17 19:29:23.373776197 +0200 @@ -1,0 +2,14 @@ +Fri Sep 15 07:37:46 UTC 2023 - Andreas Stieger <andreas.stie...@gmx.de> + +- update to 1.3.2: + * security fix for lossless decoder (boo#1215231 CVE-2023-4863) +- Drop 0001-Fix-OOB-write-in-BuildHuffmanTable.patch, + 0001-Fix-invalid-incremental-decoding-check.patch + +------------------------------------------------------------------- +Thu Sep 14 01:27:02 UTC 2023 - Xiaoguang Wang <xiaoguang.w...@suse.com> + +- Add 0001-Fix-invalid-incremental-decoding-check.patch: + [boo#1215231] [CVE-2023-4863] + +------------------------------------------------------------------- Old: ---- 0001-Fix-OOB-write-in-BuildHuffmanTable.patch libwebp-1.3.1.tar.gz libwebp-1.3.1.tar.gz.asc New: ---- libwebp-1.3.2.tar.gz libwebp-1.3.2.tar.gz.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libwebp.spec ++++++ --- /var/tmp/diff_new_pack.14BqOM/_old 2023-09-17 19:29:24.557818397 +0200 +++ /var/tmp/diff_new_pack.14BqOM/_new 2023-09-17 19:29:24.557818397 +0200 @@ -17,7 +17,7 @@ Name: libwebp -Version: 1.3.1 +Version: 1.3.2 Release: 0 Summary: Library and tools for the WebP graphics format License: BSD-3-Clause @@ -28,7 +28,6 @@ Source2: https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-%version.tar.gz.asc Source3: %name.keyring Source4: baselibs.conf -Patch1: 0001-Fix-OOB-write-in-BuildHuffmanTable.patch BuildRequires: giflib-devel BuildRequires: pkgconfig ++++++ libwebp-1.3.1.tar.gz -> libwebp-1.3.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libwebp-1.3.1/ChangeLog new/libwebp-1.3.2/ChangeLog --- old/libwebp-1.3.1/ChangeLog 2023-06-23 20:52:38.000000000 +0200 +++ new/libwebp-1.3.2/ChangeLog 2023-09-14 00:11:07.000000000 +0200 @@ -1,3 +1,7 @@ +1ace578c update NEWS +63234c42 bump version to 1.3.2 +2af26267 Fix OOB write in BuildHuffmanTable. +fd7bb21c update ChangeLog (tag: v1.3.1-rc2, tag: v1.3.1) e1adea50 update NEWS 43393320 enc/*: normalize WebPEncodingSetError() calls 287fdefe enc/*: add missing WebPEncodingSetError() calls diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libwebp-1.3.1/NEWS new/libwebp-1.3.2/NEWS --- old/libwebp-1.3.1/NEWS 2023-06-23 20:52:38.000000000 +0200 +++ new/libwebp-1.3.2/NEWS 2023-09-14 00:11:07.000000000 +0200 @@ -1,3 +1,7 @@ +- 9/13/2023: version 1.3.2 + This is a binary compatible release. + * security fix for lossless decoder (chromium: #1479274, CVE-2023-4863) + - 6/23/2023: version 1.3.1 This is a binary compatible release. * security fixes for lossless encoder (#603, chromium: #1420107, #1455619, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libwebp-1.3.1/README.md new/libwebp-1.3.2/README.md --- old/libwebp-1.3.1/README.md 2023-06-23 20:52:38.000000000 +0200 +++ new/libwebp-1.3.2/README.md 2023-09-14 00:11:07.000000000 +0200 @@ -7,7 +7,7 @@ \__\__/\____/\_____/__/ ____ ___ / _/ / \ \ / _ \/ _/ / \_/ / / \ \ __/ \__ - \____/____/\_____/_____/____/v1.3.1 + \____/____/\_____/_____/____/v1.3.2 ``` WebP codec is a library to encode and decode images in WebP format. This package diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libwebp-1.3.1/configure new/libwebp-1.3.2/configure --- old/libwebp-1.3.1/configure 2023-06-23 21:01:38.000000000 +0200 +++ new/libwebp-1.3.2/configure 2023-09-14 00:19:03.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for libwebp 1.3.1. +# Generated by GNU Autoconf 2.71 for libwebp 1.3.2. # # Report bugs to <https://bugs.chromium.org/p/webp>. # @@ -621,8 +621,8 @@ # Identity of this package. PACKAGE_NAME='libwebp' PACKAGE_TARNAME='libwebp' -PACKAGE_VERSION='1.3.1' -PACKAGE_STRING='libwebp 1.3.1' +PACKAGE_VERSION='1.3.2' +PACKAGE_STRING='libwebp 1.3.2' PACKAGE_BUGREPORT='https://bugs.chromium.org/p/webp' PACKAGE_URL='https://developers.google.com/speed/webp' @@ -1429,7 +1429,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libwebp 1.3.1 to adapt to many kinds of systems. +\`configure' configures libwebp 1.3.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1500,7 +1500,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libwebp 1.3.1:";; + short | recursive ) echo "Configuration of libwebp 1.3.2:";; esac cat <<\_ACEOF @@ -1656,7 +1656,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libwebp configure 1.3.1 +libwebp configure 1.3.2 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -1917,7 +1917,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libwebp $as_me 1.3.1, which was +It was created by libwebp $as_me 1.3.2, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -3262,7 +3262,7 @@ # Define the identity of the package. PACKAGE='libwebp' - VERSION='1.3.1' + VERSION='1.3.2' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h @@ -16346,7 +16346,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libwebp $as_me 1.3.1, which was +This file was extended by libwebp $as_me 1.3.2, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -16415,7 +16415,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -libwebp config.status 1.3.1 +libwebp config.status 1.3.2 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libwebp-1.3.1/configure.ac new/libwebp-1.3.2/configure.ac --- old/libwebp-1.3.1/configure.ac 2023-06-23 20:52:38.000000000 +0200 +++ new/libwebp-1.3.2/configure.ac 2023-09-14 00:11:07.000000000 +0200 @@ -1,4 +1,4 @@ -AC_INIT([libwebp], [1.3.1], +AC_INIT([libwebp], [1.3.2], [https://bugs.chromium.org/p/webp],, [https://developers.google.com/speed/webp]) AC_CANONICAL_HOST diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libwebp-1.3.1/extras/extras.c new/libwebp-1.3.2/extras/extras.c --- old/libwebp-1.3.1/extras/extras.c 2023-06-23 20:52:38.000000000 +0200 +++ new/libwebp-1.3.2/extras/extras.c 2023-09-14 00:11:07.000000000 +0200 @@ -19,7 +19,7 @@ #define XTRA_MAJ_VERSION 1 #define XTRA_MIN_VERSION 3 -#define XTRA_REV_VERSION 1 +#define XTRA_REV_VERSION 2 //------------------------------------------------------------------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libwebp-1.3.1/src/Makefile.am new/libwebp-1.3.2/src/Makefile.am --- old/libwebp-1.3.1/src/Makefile.am 2023-06-23 20:52:38.000000000 +0200 +++ new/libwebp-1.3.2/src/Makefile.am 2023-09-14 00:11:07.000000000 +0200 @@ -36,7 +36,7 @@ # other than the ones listed on the command line, i.e., after linking, it will # not have unresolved symbols. Some platforms (Windows among them) require all # symbols in shared libraries to be resolved at library creation. -libwebp_la_LDFLAGS = -no-undefined -version-info 8:7:1 +libwebp_la_LDFLAGS = -no-undefined -version-info 8:8:1 libwebpincludedir = $(includedir)/webp pkgconfig_DATA = libwebp.pc @@ -48,7 +48,7 @@ libwebpdecoder_la_LIBADD += dsp/libwebpdspdecode.la libwebpdecoder_la_LIBADD += utils/libwebputilsdecode.la - libwebpdecoder_la_LDFLAGS = -no-undefined -version-info 4:7:1 + libwebpdecoder_la_LDFLAGS = -no-undefined -version-info 4:8:1 pkgconfig_DATA += libwebpdecoder.pc endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libwebp-1.3.1/src/Makefile.in new/libwebp-1.3.2/src/Makefile.in --- old/libwebp-1.3.1/src/Makefile.in 2023-06-23 21:01:39.000000000 +0200 +++ new/libwebp-1.3.2/src/Makefile.in 2023-09-14 00:19:04.000000000 +0200 @@ -426,7 +426,7 @@ # other than the ones listed on the command line, i.e., after linking, it will # not have unresolved symbols. Some platforms (Windows among them) require all # symbols in shared libraries to be resolved at library creation. -libwebp_la_LDFLAGS = -no-undefined -version-info 8:7:1 +libwebp_la_LDFLAGS = -no-undefined -version-info 8:8:1 libwebpincludedir = $(includedir)/webp pkgconfig_DATA = libwebp.pc $(am__append_4) @BUILD_LIBWEBPDECODER_TRUE@libwebpdecoder_la_SOURCES = @@ -434,7 +434,7 @@ @BUILD_LIBWEBPDECODER_TRUE@ dec/libwebpdecode.la \ @BUILD_LIBWEBPDECODER_TRUE@ dsp/libwebpdspdecode.la \ @BUILD_LIBWEBPDECODER_TRUE@ utils/libwebputilsdecode.la -@BUILD_LIBWEBPDECODER_TRUE@libwebpdecoder_la_LDFLAGS = -no-undefined -version-info 4:7:1 +@BUILD_LIBWEBPDECODER_TRUE@libwebpdecoder_la_LDFLAGS = -no-undefined -version-info 4:8:1 all: all-recursive .SUFFIXES: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libwebp-1.3.1/src/dec/vp8i_dec.h new/libwebp-1.3.2/src/dec/vp8i_dec.h --- old/libwebp-1.3.1/src/dec/vp8i_dec.h 2023-06-23 20:52:38.000000000 +0200 +++ new/libwebp-1.3.2/src/dec/vp8i_dec.h 2023-09-14 00:11:07.000000000 +0200 @@ -32,7 +32,7 @@ // version numbers #define DEC_MAJ_VERSION 1 #define DEC_MIN_VERSION 3 -#define DEC_REV_VERSION 1 +#define DEC_REV_VERSION 2 // YUV-cache parameters. Cache is 32-bytes wide (= one cacheline). // Constraints are: We need to store one 16x16 block of luma samples (y), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libwebp-1.3.1/src/dec/vp8l_dec.c new/libwebp-1.3.2/src/dec/vp8l_dec.c --- old/libwebp-1.3.1/src/dec/vp8l_dec.c 2023-06-23 20:52:38.000000000 +0200 +++ new/libwebp-1.3.2/src/dec/vp8l_dec.c 2023-09-14 00:11:07.000000000 +0200 @@ -253,11 +253,11 @@ int symbol; int max_symbol; int prev_code_len = DEFAULT_CODE_LENGTH; - HuffmanCode table[1 << LENGTHS_TABLE_BITS]; + HuffmanTables tables; - if (!VP8LBuildHuffmanTable(table, LENGTHS_TABLE_BITS, - code_length_code_lengths, - NUM_CODE_LENGTH_CODES)) { + if (!VP8LHuffmanTablesAllocate(1 << LENGTHS_TABLE_BITS, &tables) || + !VP8LBuildHuffmanTable(&tables, LENGTHS_TABLE_BITS, + code_length_code_lengths, NUM_CODE_LENGTH_CODES)) { goto End; } @@ -277,7 +277,7 @@ int code_len; if (max_symbol-- == 0) break; VP8LFillBitWindow(br); - p = &table[VP8LPrefetchBits(br) & LENGTHS_TABLE_MASK]; + p = &tables.curr_segment->start[VP8LPrefetchBits(br) & LENGTHS_TABLE_MASK]; VP8LSetBitPos(br, br->bit_pos_ + p->bits); code_len = p->value; if (code_len < kCodeLengthLiterals) { @@ -300,6 +300,7 @@ ok = 1; End: + VP8LHuffmanTablesDeallocate(&tables); if (!ok) dec->status_ = VP8_STATUS_BITSTREAM_ERROR; return ok; } @@ -307,7 +308,8 @@ // 'code_lengths' is pre-allocated temporary buffer, used for creating Huffman // tree. static int ReadHuffmanCode(int alphabet_size, VP8LDecoder* const dec, - int* const code_lengths, HuffmanCode* const table) { + int* const code_lengths, + HuffmanTables* const table) { int ok = 0; int size = 0; VP8LBitReader* const br = &dec->br_; @@ -362,8 +364,7 @@ VP8LMetadata* const hdr = &dec->hdr_; uint32_t* huffman_image = NULL; HTreeGroup* htree_groups = NULL; - HuffmanCode* huffman_tables = NULL; - HuffmanCode* huffman_table = NULL; + HuffmanTables* huffman_tables = &hdr->huffman_tables_; int num_htree_groups = 1; int num_htree_groups_max = 1; int max_alphabet_size = 0; @@ -372,6 +373,10 @@ int* mapping = NULL; int ok = 0; + // Check the table has been 0 initialized (through InitMetadata). + assert(huffman_tables->root.start == NULL); + assert(huffman_tables->curr_segment == NULL); + if (allow_recursion && VP8LReadBits(br, 1)) { // use meta Huffman codes. const int huffman_precision = VP8LReadBits(br, 3) + 2; @@ -434,16 +439,15 @@ code_lengths = (int*)WebPSafeCalloc((uint64_t)max_alphabet_size, sizeof(*code_lengths)); - huffman_tables = (HuffmanCode*)WebPSafeMalloc(num_htree_groups * table_size, - sizeof(*huffman_tables)); htree_groups = VP8LHtreeGroupsNew(num_htree_groups); - if (htree_groups == NULL || code_lengths == NULL || huffman_tables == NULL) { + if (htree_groups == NULL || code_lengths == NULL || + !VP8LHuffmanTablesAllocate(num_htree_groups * table_size, + huffman_tables)) { dec->status_ = VP8_STATUS_OUT_OF_MEMORY; goto Error; } - huffman_table = huffman_tables; for (i = 0; i < num_htree_groups_max; ++i) { // If the index "i" is unused in the Huffman image, just make sure the // coefficients are valid but do not store them. @@ -468,19 +472,20 @@ int max_bits = 0; for (j = 0; j < HUFFMAN_CODES_PER_META_CODE; ++j) { int alphabet_size = kAlphabetSize[j]; - htrees[j] = huffman_table; if (j == 0 && color_cache_bits > 0) { alphabet_size += (1 << color_cache_bits); } - size = ReadHuffmanCode(alphabet_size, dec, code_lengths, huffman_table); + size = + ReadHuffmanCode(alphabet_size, dec, code_lengths, huffman_tables); + htrees[j] = huffman_tables->curr_segment->curr_table; if (size == 0) { goto Error; } if (is_trivial_literal && kLiteralMap[j] == 1) { - is_trivial_literal = (huffman_table->bits == 0); + is_trivial_literal = (htrees[j]->bits == 0); } - total_size += huffman_table->bits; - huffman_table += size; + total_size += htrees[j]->bits; + huffman_tables->curr_segment->curr_table += size; if (j <= ALPHA) { int local_max_bits = code_lengths[0]; int k; @@ -515,14 +520,13 @@ hdr->huffman_image_ = huffman_image; hdr->num_htree_groups_ = num_htree_groups; hdr->htree_groups_ = htree_groups; - hdr->huffman_tables_ = huffman_tables; Error: WebPSafeFree(code_lengths); WebPSafeFree(mapping); if (!ok) { WebPSafeFree(huffman_image); - WebPSafeFree(huffman_tables); + VP8LHuffmanTablesDeallocate(huffman_tables); VP8LHtreeGroupsFree(htree_groups); } return ok; @@ -1358,7 +1362,7 @@ assert(hdr != NULL); WebPSafeFree(hdr->huffman_image_); - WebPSafeFree(hdr->huffman_tables_); + VP8LHuffmanTablesDeallocate(&hdr->huffman_tables_); VP8LHtreeGroupsFree(hdr->htree_groups_); VP8LColorCacheClear(&hdr->color_cache_); VP8LColorCacheClear(&hdr->saved_color_cache_); @@ -1673,7 +1677,7 @@ if (dec == NULL) return 0; - assert(dec->hdr_.huffman_tables_ != NULL); + assert(dec->hdr_.huffman_tables_.root.start != NULL); assert(dec->hdr_.htree_groups_ != NULL); assert(dec->hdr_.num_htree_groups_ > 0); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libwebp-1.3.1/src/dec/vp8li_dec.h new/libwebp-1.3.2/src/dec/vp8li_dec.h --- old/libwebp-1.3.1/src/dec/vp8li_dec.h 2023-06-23 20:52:38.000000000 +0200 +++ new/libwebp-1.3.2/src/dec/vp8li_dec.h 2023-09-14 00:11:07.000000000 +0200 @@ -51,7 +51,7 @@ uint32_t* huffman_image_; int num_htree_groups_; HTreeGroup* htree_groups_; - HuffmanCode* huffman_tables_; + HuffmanTables huffman_tables_; } VP8LMetadata; typedef struct VP8LDecoder VP8LDecoder; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libwebp-1.3.1/src/demux/Makefile.am new/libwebp-1.3.2/src/demux/Makefile.am --- old/libwebp-1.3.1/src/demux/Makefile.am 2023-06-23 20:52:38.000000000 +0200 +++ new/libwebp-1.3.2/src/demux/Makefile.am 2023-09-14 00:11:07.000000000 +0200 @@ -13,6 +13,6 @@ noinst_HEADERS += ../webp/format_constants.h libwebpdemux_la_LIBADD = ../libwebp.la -libwebpdemux_la_LDFLAGS = -no-undefined -version-info 2:13:0 +libwebpdemux_la_LDFLAGS = -no-undefined -version-info 2:14:0 libwebpdemuxincludedir = $(includedir)/webp pkgconfig_DATA = libwebpdemux.pc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libwebp-1.3.1/src/demux/Makefile.in new/libwebp-1.3.2/src/demux/Makefile.in --- old/libwebp-1.3.1/src/demux/Makefile.in 2023-06-23 21:01:39.000000000 +0200 +++ new/libwebp-1.3.2/src/demux/Makefile.in 2023-09-14 00:19:04.000000000 +0200 @@ -361,7 +361,7 @@ ../webp/mux_types.h ../webp/types.h noinst_HEADERS = ../webp/format_constants.h libwebpdemux_la_LIBADD = ../libwebp.la -libwebpdemux_la_LDFLAGS = -no-undefined -version-info 2:13:0 +libwebpdemux_la_LDFLAGS = -no-undefined -version-info 2:14:0 libwebpdemuxincludedir = $(includedir)/webp pkgconfig_DATA = libwebpdemux.pc all: all-am diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libwebp-1.3.1/src/demux/demux.c new/libwebp-1.3.2/src/demux/demux.c --- old/libwebp-1.3.1/src/demux/demux.c 2023-06-23 20:52:38.000000000 +0200 +++ new/libwebp-1.3.2/src/demux/demux.c 2023-09-14 00:11:07.000000000 +0200 @@ -25,7 +25,7 @@ #define DMUX_MAJ_VERSION 1 #define DMUX_MIN_VERSION 3 -#define DMUX_REV_VERSION 1 +#define DMUX_REV_VERSION 2 typedef struct { size_t start_; // start location of the data diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libwebp-1.3.1/src/demux/libwebpdemux.rc new/libwebp-1.3.2/src/demux/libwebpdemux.rc --- old/libwebp-1.3.1/src/demux/libwebpdemux.rc 2023-06-23 20:52:38.000000000 +0200 +++ new/libwebp-1.3.2/src/demux/libwebpdemux.rc 2023-09-14 00:11:07.000000000 +0200 @@ -6,8 +6,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,3,1 - PRODUCTVERSION 1,0,3,1 + FILEVERSION 1,0,3,2 + PRODUCTVERSION 1,0,3,2 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -24,12 +24,12 @@ BEGIN VALUE "CompanyName", "Google, Inc." VALUE "FileDescription", "libwebpdemux DLL" - VALUE "FileVersion", "1.3.1" + VALUE "FileVersion", "1.3.2" VALUE "InternalName", "libwebpdemux.dll" VALUE "LegalCopyright", "Copyright (C) 2023" VALUE "OriginalFilename", "libwebpdemux.dll" VALUE "ProductName", "WebP Image Demuxer" - VALUE "ProductVersion", "1.3.1" + VALUE "ProductVersion", "1.3.2" END END BLOCK "VarFileInfo" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libwebp-1.3.1/src/enc/vp8i_enc.h new/libwebp-1.3.2/src/enc/vp8i_enc.h --- old/libwebp-1.3.1/src/enc/vp8i_enc.h 2023-06-23 20:52:38.000000000 +0200 +++ new/libwebp-1.3.2/src/enc/vp8i_enc.h 2023-09-14 00:11:07.000000000 +0200 @@ -32,7 +32,7 @@ // version numbers #define ENC_MAJ_VERSION 1 #define ENC_MIN_VERSION 3 -#define ENC_REV_VERSION 1 +#define ENC_REV_VERSION 2 enum { MAX_LF_LEVELS = 64, // Maximum loop filter level MAX_VARIABLE_LEVEL = 67, // last (inclusive) level with variable cost diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libwebp-1.3.1/src/libwebp.rc new/libwebp-1.3.2/src/libwebp.rc --- old/libwebp-1.3.1/src/libwebp.rc 2023-06-23 20:52:38.000000000 +0200 +++ new/libwebp-1.3.2/src/libwebp.rc 2023-09-14 00:11:07.000000000 +0200 @@ -6,8 +6,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,3,1 - PRODUCTVERSION 1,0,3,1 + FILEVERSION 1,0,3,2 + PRODUCTVERSION 1,0,3,2 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -24,12 +24,12 @@ BEGIN VALUE "CompanyName", "Google, Inc." VALUE "FileDescription", "libwebp DLL" - VALUE "FileVersion", "1.3.1" + VALUE "FileVersion", "1.3.2" VALUE "InternalName", "libwebp.dll" VALUE "LegalCopyright", "Copyright (C) 2023" VALUE "OriginalFilename", "libwebp.dll" VALUE "ProductName", "WebP Image Codec" - VALUE "ProductVersion", "1.3.1" + VALUE "ProductVersion", "1.3.2" END END BLOCK "VarFileInfo" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libwebp-1.3.1/src/libwebpdecoder.rc new/libwebp-1.3.2/src/libwebpdecoder.rc --- old/libwebp-1.3.1/src/libwebpdecoder.rc 2023-06-23 20:52:38.000000000 +0200 +++ new/libwebp-1.3.2/src/libwebpdecoder.rc 2023-09-14 00:11:07.000000000 +0200 @@ -6,8 +6,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,3,1 - PRODUCTVERSION 1,0,3,1 + FILEVERSION 1,0,3,2 + PRODUCTVERSION 1,0,3,2 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -24,12 +24,12 @@ BEGIN VALUE "CompanyName", "Google, Inc." VALUE "FileDescription", "libwebpdecoder DLL" - VALUE "FileVersion", "1.3.1" + VALUE "FileVersion", "1.3.2" VALUE "InternalName", "libwebpdecoder.dll" VALUE "LegalCopyright", "Copyright (C) 2023" VALUE "OriginalFilename", "libwebpdecoder.dll" VALUE "ProductName", "WebP Image Decoder" - VALUE "ProductVersion", "1.3.1" + VALUE "ProductVersion", "1.3.2" END END BLOCK "VarFileInfo" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libwebp-1.3.1/src/mux/Makefile.am new/libwebp-1.3.2/src/mux/Makefile.am --- old/libwebp-1.3.1/src/mux/Makefile.am 2023-06-23 20:52:38.000000000 +0200 +++ new/libwebp-1.3.2/src/mux/Makefile.am 2023-09-14 00:11:07.000000000 +0200 @@ -17,6 +17,6 @@ noinst_HEADERS += ../webp/format_constants.h libwebpmux_la_LIBADD = ../libwebp.la -libwebpmux_la_LDFLAGS = -no-undefined -version-info 3:12:0 -lm +libwebpmux_la_LDFLAGS = -no-undefined -version-info 3:13:0 -lm libwebpmuxincludedir = $(includedir)/webp pkgconfig_DATA = libwebpmux.pc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libwebp-1.3.1/src/mux/Makefile.in new/libwebp-1.3.2/src/mux/Makefile.in --- old/libwebp-1.3.1/src/mux/Makefile.in 2023-06-23 21:01:39.000000000 +0200 +++ new/libwebp-1.3.2/src/mux/Makefile.in 2023-09-14 00:19:04.000000000 +0200 @@ -363,7 +363,7 @@ ../webp/types.h noinst_HEADERS = ../webp/format_constants.h libwebpmux_la_LIBADD = ../libwebp.la -libwebpmux_la_LDFLAGS = -no-undefined -version-info 3:12:0 -lm +libwebpmux_la_LDFLAGS = -no-undefined -version-info 3:13:0 -lm libwebpmuxincludedir = $(includedir)/webp pkgconfig_DATA = libwebpmux.pc all: all-am diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libwebp-1.3.1/src/mux/libwebpmux.rc new/libwebp-1.3.2/src/mux/libwebpmux.rc --- old/libwebp-1.3.1/src/mux/libwebpmux.rc 2023-06-23 20:52:38.000000000 +0200 +++ new/libwebp-1.3.2/src/mux/libwebpmux.rc 2023-09-14 00:11:07.000000000 +0200 @@ -6,8 +6,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,3,1 - PRODUCTVERSION 1,0,3,1 + FILEVERSION 1,0,3,2 + PRODUCTVERSION 1,0,3,2 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -24,12 +24,12 @@ BEGIN VALUE "CompanyName", "Google, Inc." VALUE "FileDescription", "libwebpmux DLL" - VALUE "FileVersion", "1.3.1" + VALUE "FileVersion", "1.3.2" VALUE "InternalName", "libwebpmux.dll" VALUE "LegalCopyright", "Copyright (C) 2023" VALUE "OriginalFilename", "libwebpmux.dll" VALUE "ProductName", "WebP Image Muxer" - VALUE "ProductVersion", "1.3.1" + VALUE "ProductVersion", "1.3.2" END END BLOCK "VarFileInfo" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libwebp-1.3.1/src/mux/muxi.h new/libwebp-1.3.2/src/mux/muxi.h --- old/libwebp-1.3.1/src/mux/muxi.h 2023-06-23 20:52:38.000000000 +0200 +++ new/libwebp-1.3.2/src/mux/muxi.h 2023-09-14 00:11:07.000000000 +0200 @@ -29,7 +29,7 @@ #define MUX_MAJ_VERSION 1 #define MUX_MIN_VERSION 3 -#define MUX_REV_VERSION 1 +#define MUX_REV_VERSION 2 // Chunk object. typedef struct WebPChunk WebPChunk; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libwebp-1.3.1/src/utils/huffman_utils.c new/libwebp-1.3.2/src/utils/huffman_utils.c --- old/libwebp-1.3.1/src/utils/huffman_utils.c 2023-06-23 20:52:38.000000000 +0200 +++ new/libwebp-1.3.2/src/utils/huffman_utils.c 2023-09-14 00:11:07.000000000 +0200 @@ -177,21 +177,24 @@ if (num_open < 0) { return 0; } - if (root_table == NULL) continue; for (; count[len] > 0; --count[len]) { HuffmanCode code; if ((key & mask) != low) { - table += table_size; + if (root_table != NULL) table += table_size; table_bits = NextTableBitSize(count, len, root_bits); table_size = 1 << table_bits; total_size += table_size; low = key & mask; - root_table[low].bits = (uint8_t)(table_bits + root_bits); - root_table[low].value = (uint16_t)((table - root_table) - low); + if (root_table != NULL) { + root_table[low].bits = (uint8_t)(table_bits + root_bits); + root_table[low].value = (uint16_t)((table - root_table) - low); + } + } + if (root_table != NULL) { + code.bits = (uint8_t)(len - root_bits); + code.value = (uint16_t)sorted[symbol++]; + ReplicateValue(&table[key >> root_bits], step, table_size, code); } - code.bits = (uint8_t)(len - root_bits); - code.value = (uint16_t)sorted[symbol++]; - ReplicateValue(&table[key >> root_bits], step, table_size, code); key = GetNextKey(key, len); } } @@ -211,25 +214,83 @@ ((1 << MAX_CACHE_BITS) + NUM_LITERAL_CODES + NUM_LENGTH_CODES) // Cut-off value for switching between heap and stack allocation. #define SORTED_SIZE_CUTOFF 512 -int VP8LBuildHuffmanTable(HuffmanCode* const root_table, int root_bits, +int VP8LBuildHuffmanTable(HuffmanTables* const root_table, int root_bits, const int code_lengths[], int code_lengths_size) { - int total_size; + const int total_size = + BuildHuffmanTable(NULL, root_bits, code_lengths, code_lengths_size, NULL); assert(code_lengths_size <= MAX_CODE_LENGTHS_SIZE); - if (root_table == NULL) { - total_size = BuildHuffmanTable(NULL, root_bits, - code_lengths, code_lengths_size, NULL); - } else if (code_lengths_size <= SORTED_SIZE_CUTOFF) { + if (total_size == 0 || root_table == NULL) return total_size; + + if (root_table->curr_segment->curr_table + total_size >= + root_table->curr_segment->start + root_table->curr_segment->size) { + // If 'root_table' does not have enough memory, allocate a new segment. + // The available part of root_table->curr_segment is left unused because we + // need a contiguous buffer. + const int segment_size = root_table->curr_segment->size; + struct HuffmanTablesSegment* next = + (HuffmanTablesSegment*)WebPSafeMalloc(1, sizeof(*next)); + if (next == NULL) return 0; + // Fill the new segment. + // We need at least 'total_size' but if that value is small, it is better to + // allocate a big chunk to prevent more allocations later. 'segment_size' is + // therefore chosen (any other arbitrary value could be chosen). + next->size = total_size > segment_size ? total_size : segment_size; + next->start = + (HuffmanCode*)WebPSafeMalloc(next->size, sizeof(*next->start)); + if (next->start == NULL) { + WebPSafeFree(next); + return 0; + } + next->curr_table = next->start; + next->next = NULL; + // Point to the new segment. + root_table->curr_segment->next = next; + root_table->curr_segment = next; + } + if (code_lengths_size <= SORTED_SIZE_CUTOFF) { // use local stack-allocated array. uint16_t sorted[SORTED_SIZE_CUTOFF]; - total_size = BuildHuffmanTable(root_table, root_bits, - code_lengths, code_lengths_size, sorted); - } else { // rare case. Use heap allocation. + BuildHuffmanTable(root_table->curr_segment->curr_table, root_bits, + code_lengths, code_lengths_size, sorted); + } else { // rare case. Use heap allocation. uint16_t* const sorted = (uint16_t*)WebPSafeMalloc(code_lengths_size, sizeof(*sorted)); if (sorted == NULL) return 0; - total_size = BuildHuffmanTable(root_table, root_bits, - code_lengths, code_lengths_size, sorted); + BuildHuffmanTable(root_table->curr_segment->curr_table, root_bits, + code_lengths, code_lengths_size, sorted); WebPSafeFree(sorted); } return total_size; } + +int VP8LHuffmanTablesAllocate(int size, HuffmanTables* huffman_tables) { + // Have 'segment' point to the first segment for now, 'root'. + HuffmanTablesSegment* const root = &huffman_tables->root; + huffman_tables->curr_segment = root; + // Allocate root. + root->start = (HuffmanCode*)WebPSafeMalloc(size, sizeof(*root->start)); + if (root->start == NULL) return 0; + root->curr_table = root->start; + root->next = NULL; + root->size = size; + return 1; +} + +void VP8LHuffmanTablesDeallocate(HuffmanTables* const huffman_tables) { + HuffmanTablesSegment *current, *next; + if (huffman_tables == NULL) return; + // Free the root node. + current = &huffman_tables->root; + next = current->next; + WebPSafeFree(current->start); + current->start = NULL; + current->next = NULL; + current = next; + // Free the following nodes. + while (current != NULL) { + next = current->next; + WebPSafeFree(current->start); + WebPSafeFree(current); + current = next; + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libwebp-1.3.1/src/utils/huffman_utils.h new/libwebp-1.3.2/src/utils/huffman_utils.h --- old/libwebp-1.3.1/src/utils/huffman_utils.h 2023-06-23 20:52:38.000000000 +0200 +++ new/libwebp-1.3.2/src/utils/huffman_utils.h 2023-09-14 00:11:07.000000000 +0200 @@ -43,6 +43,29 @@ // or non-literal symbol otherwise } HuffmanCode32; +// Contiguous memory segment of HuffmanCodes. +typedef struct HuffmanTablesSegment { + HuffmanCode* start; + // Pointer to where we are writing into the segment. Starts at 'start' and + // cannot go beyond 'start' + 'size'. + HuffmanCode* curr_table; + // Pointer to the next segment in the chain. + struct HuffmanTablesSegment* next; + int size; +} HuffmanTablesSegment; + +// Chained memory segments of HuffmanCodes. +typedef struct HuffmanTables { + HuffmanTablesSegment root; + // Currently processed segment. At first, this is 'root'. + HuffmanTablesSegment* curr_segment; +} HuffmanTables; + +// Allocates a HuffmanTables with 'size' contiguous HuffmanCodes. Returns 0 on +// memory allocation error, 1 otherwise. +int VP8LHuffmanTablesAllocate(int size, HuffmanTables* huffman_tables); +void VP8LHuffmanTablesDeallocate(HuffmanTables* const huffman_tables); + #define HUFFMAN_PACKED_BITS 6 #define HUFFMAN_PACKED_TABLE_SIZE (1u << HUFFMAN_PACKED_BITS) @@ -78,9 +101,7 @@ // the huffman table. // Returns built table size or 0 in case of error (invalid tree or // memory error). -// If root_table is NULL, it returns 0 if a lookup cannot be built, something -// > 0 otherwise (but not the table size). -int VP8LBuildHuffmanTable(HuffmanCode* const root_table, int root_bits, +int VP8LBuildHuffmanTable(HuffmanTables* const root_table, int root_bits, const int code_lengths[], int code_lengths_size); #ifdef __cplusplus