Blame SOURCES/djvulibre-3.5.27-null-dereference.patch

a9380a
From c8bec6549c10ffaa2f2fbad8bbc629efdf0dd125 Mon Sep 17 00:00:00 2001
a9380a
From: Leon Bottou <leon@bottou.org>
a9380a
Date: Thu, 17 Oct 2019 22:20:31 -0400
a9380a
Subject: [PATCH 1/2] Fixed bug 309
a9380a
a9380a
---
a9380a
 libdjvu/IW44EncodeCodec.cpp | 2 +-
a9380a
 tools/ddjvu.cpp             | 2 +-
a9380a
 2 files changed, 2 insertions(+), 2 deletions(-)
a9380a
a9380a
diff --git a/libdjvu/IW44EncodeCodec.cpp b/libdjvu/IW44EncodeCodec.cpp
a9380a
index 00752a0..f81eaeb 100644
a9380a
--- a/libdjvu/IW44EncodeCodec.cpp
a9380a
+++ b/libdjvu/IW44EncodeCodec.cpp
a9380a
@@ -405,7 +405,7 @@ filter_fv(short *p, int w, int h, int rowsize, int scale)
a9380a
   int y = 0;
a9380a
   int s = scale*rowsize;
a9380a
   int s3 = s+s+s;
a9380a
-  h = ((h-1)/scale)+1;
a9380a
+  h = (h>0) ? ((h-1)/scale)+1 : 0;
a9380a
   y += 1;
a9380a
   p += s;
a9380a
   while (y-3 < h)
a9380a
diff --git a/tools/ddjvu.cpp b/tools/ddjvu.cpp
a9380a
index 6d0df3b..7109952 100644
a9380a
--- a/tools/ddjvu.cpp
a9380a
+++ b/tools/ddjvu.cpp
a9380a
@@ -279,7 +279,7 @@ render(ddjvu_page_t *page, int pageno)
a9380a
       prect.h = (ih * 100) / dpi;
a9380a
     }
a9380a
   /* Process aspect ratio */
a9380a
-  if (flag_aspect <= 0)
a9380a
+  if (flag_aspect <= 0 && iw>0 && ih>0)
a9380a
     {
a9380a
       double dw = (double)iw / prect.w;
a9380a
       double dh = (double)ih / prect.h;
a9380a
-- 
a9380a
2.23.0
a9380a