From a860c0328fab63e86f088d4774ea4e6fa2bee12e Mon Sep 17 00:00:00 2001 From: Marek Kasik Date: Thu, 7 Nov 2019 16:25:54 +0100 Subject: [PATCH] Fix a crash due to missing zero-bytes check Resolves: #1767921 --- djvulibre-3.5.27-zero-bytes-check.patch | 28 +++++++++++++++++++++++++ djvulibre.spec | 8 ++++++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 djvulibre-3.5.27-zero-bytes-check.patch diff --git a/djvulibre-3.5.27-zero-bytes-check.patch b/djvulibre-3.5.27-zero-bytes-check.patch new file mode 100644 index 0000000..958c3f8 --- /dev/null +++ b/djvulibre-3.5.27-zero-bytes-check.patch @@ -0,0 +1,28 @@ +From 9658b01431cd7ff6344d7787f855179e73fe81a7 Mon Sep 17 00:00:00 2001 +From: Leon Bottou +Date: Mon, 8 Apr 2019 22:55:38 -0400 +Subject: fix bug #298 + + +diff --git a/libdjvu/GBitmap.h b/libdjvu/GBitmap.h +index e8e0c9b..ca89a19 100644 +--- a/libdjvu/GBitmap.h ++++ b/libdjvu/GBitmap.h +@@ -566,7 +566,7 @@ GBitmap::operator[](int row) + { + if (!bytes) + uncompress(); +- if (row<0 || row>=nrows) { ++ if (row<0 || row>=nrows || !bytes) { + #ifndef NDEBUG + if (zerosize < bytes_per_row + border) + G_THROW( ERR_MSG("GBitmap.zero_small") ); +@@ -581,7 +581,7 @@ GBitmap::operator[](int row) const + { + if (!bytes) + ((GBitmap*)this)->uncompress(); +- if (row<0 || row>=nrows) { ++ if (row<0 || row>=nrows || !bytes) { + #ifndef NDEBUG + if (zerosize < bytes_per_row + border) + G_THROW( ERR_MSG("GBitmap.zero_small") ); diff --git a/djvulibre.spec b/djvulibre.spec index e131c85..327a09a 100644 --- a/djvulibre.spec +++ b/djvulibre.spec @@ -3,7 +3,7 @@ Summary: DjVu viewers, encoders, and utilities Name: djvulibre Version: 3.5.27 -Release: 15%{?dist} +Release: 16%{?dist} License: GPLv2+ URL: http://djvu.sourceforge.net/ Source0: http://downloads.sourceforge.net/djvu/%{name}-%{version}.tar.gz @@ -12,6 +12,7 @@ Patch0: djvulibre-3.5.22-cdefs.patch Patch2: djvulibre-3.5.27-buffer-overflow.patch Patch3: djvulibre-3.5.27-infinite-loop.patch Patch4: djvulibre-3.5.27-stack-overflow.patch +Patch5: djvulibre-3.5.27-zero-bytes-check.patch Requires(post): xdg-utils Requires(preun): xdg-utils @@ -67,6 +68,7 @@ Development files for DjVuLibre. %patch2 -p1 -b .buffer-overflow %patch3 -p1 -b .infinite-loop %patch4 -p1 -b .stack-overflow +%patch5 -p1 -b .zero-bytes-check %build @@ -174,6 +176,10 @@ fi %changelog +* Thu Nov 7 2019 Marek Kasik - 3.5.27-16 +- Fix a crash due to missing zero-bytes check +- Resolves: #1767921 + * Thu Nov 7 2019 Marek Kasik - 3.5.27-15 - Fix a stack overflow - Resolves: #1767868