File libwebp-CVE-2016-9969.patch of Package libwebp.38637

diff --unified --recursive --text --new-file --color libwebp-0.5.0/src/mux/anim_encode.c libwebp-0.5.0.new/src/mux/anim_encode.c
--- libwebp-0.5.0/src/mux/anim_encode.c	2015-12-18 16:04:24.000000000 +0800
+++ libwebp-0.5.0.new/src/mux/anim_encode.c	2025-05-08 11:51:00.404966033 +0800
@@ -730,19 +730,20 @@
   const int use_blending =
       !is_key_frame &&
       IsBlendingPossible(prev_canvas, curr_canvas, rect);
+  int evaluate_ll, evaluate_lossy;
 
   // Pick candidates to be tried.
   if (!enc->options_.allow_mixed) {
-    candidate_ll->evaluate_ = is_lossless;
-    candidate_lossy->evaluate_ = !is_lossless;
+    evaluate_ll = is_lossless;
+    evaluate_lossy = !is_lossless;
   } else {  // Use a heuristic for trying lossless and/or lossy compression.
     const int num_colors = GetColorCount(sub_frame);
-    candidate_ll->evaluate_ = (num_colors < MAX_COLORS_LOSSLESS);
-    candidate_lossy->evaluate_ = (num_colors >= MIN_COLORS_LOSSY);
+    evaluate_ll = (num_colors < MAX_COLORS_LOSSLESS);
+    evaluate_lossy = (num_colors >= MIN_COLORS_LOSSY);
   }
 
   // Generate candidates.
-  if (candidate_ll->evaluate_) {
+  if (evaluate_ll) {
     CopyCurrentCanvas(enc);
     if (use_blending) {
       IncreaseTransparency(prev_canvas, rect, curr_canvas);
@@ -752,7 +753,7 @@
                                  candidate_ll);
     if (error_code != VP8_ENC_OK) return error_code;
   }
-  if (candidate_lossy->evaluate_) {
+  if (evaluate_lossy) {
     CopyCurrentCanvas(enc);
     if (use_blending) {
       FlattenSimilarBlocks(prev_canvas, rect, curr_canvas);
@@ -949,9 +950,7 @@
     return VP8_ENC_ERROR_INVALID_CONFIGURATION;
   }
 
-  for (i = 0; i < CANDIDATE_COUNT; ++i) {
-    candidates[i].evaluate_ = 0;
-  }
+  memset(candidates, 0, sizeof(candidates));
 
   // Change-rectangle assuming previous frame was DISPOSE_NONE.
   GetSubRect(prev_canvas, curr_canvas, is_key_frame, is_first_frame,
openSUSE Build Service is sponsored by