Submitted By: Ken Moffat <ken at linuxfromscratch dot org>
Date: 2023-04-11
Initial Package Version: 1.3.0
Upstream Status: Applied
Origin: Upstream, self
Description: Fixes webp bug 603,
Self: Add data to pkgconfig file to determine if patch has been applied.

commit a486d800b60d0af4cc0836bf7ed8f21e12974129
Author: James Zern <jzern@google.com>
Date:   Wed Feb 22 22:15:47 2023 -0800

    EncodeAlphaInternal: clear result->bw on error
    
    This avoids a double free should the function fail prior to
    VP8BitWriterInit() and a previous trial result's buffer carried over.
    Previously in ApplyFiltersAndEncode() trial.bw (with a previous
    iteration's buffer) would be freed, followed by best.bw pointing to the
    same buffer.
    
    Since:
    187d379d add a fallback to ALPHA_NO_COMPRESSION
    
    In addition, check the return value of VP8BitWriterInit() in this
    function.
    
    Bug: webp:603
    Change-Id: Ic258381ee26c8c16bc211d157c8153831c8c6910

diff -Naur a/src/enc/alpha_enc.c b/src/enc/alpha_enc.c
--- a/src/enc/alpha_enc.c	2022-12-20 00:23:35.000000000 +0000
+++ b/src/enc/alpha_enc.c	2023-04-04 23:52:02.263532118 +0100
@@ -13,6 +13,7 @@
 
 #include <assert.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include "src/enc/vp8i_enc.h"
 #include "src/dsp/dsp.h"
@@ -148,6 +149,7 @@
       }
     } else {
       VP8LBitWriterWipeOut(&tmp_bw);
+      memset(&result->bw, 0, sizeof(result->bw));
       return 0;
     }
   }
@@ -162,7 +164,7 @@
   header = method | (filter << 2);
   if (reduce_levels) header |= ALPHA_PREPROCESSED_LEVELS << 4;
 
-  VP8BitWriterInit(&result->bw, ALPHA_HEADER_LEN + output_size);
+  if (!VP8BitWriterInit(&result->bw, ALPHA_HEADER_LEN + output_size)) ok = 0;
   ok = ok && VP8BitWriterAppend(&result->bw, &header, ALPHA_HEADER_LEN);
   ok = ok && VP8BitWriterAppend(&result->bw, output, output_size);
 
diff -Naur a/src/libwebp.pc.in b/src/libwebp.pc.in
--- a/src/libwebp.pc.in	2022-12-20 00:23:35.000000000 +0000
+++ b/src/libwebp.pc.in	2023-04-04 23:53:47.705716384 +0100
@@ -4,7 +4,7 @@
 includedir=@includedir@
 
 Name: libwebp
-Description: Library for the WebP graphics format
+Description: Library for the WebP graphics format with BLFS patch 1
 Version: @PACKAGE_VERSION@
 Requires: libsharpyuv
 Cflags: -I${includedir}
