Commit 675ef6c9 authored by Vladimir Bashkirtsev's avatar Vladimir Bashkirtsev

Updated mupdf to 1.18.0

parent 2129c9b0
all:
tar xf mupdf-1.17.0-source.tar.gz
# rm -rf mupdf-1.17.0-source/thirdparty/curl
# rm -rf mupdf-1.17.0-source/thirdparty/freeglut
# rm -rf mupdf-1.17.0-source/thirdparty/freetype
# rm -rf mupdf-1.17.0-source/thirdparty/harfbuzz
# rm -rf mupdf-1.17.0-source/thirdparty/jpeg
# rm -rf mupdf-1.17.0-source/thirdparty/lcms2
# rm -rf mupdf-1.17.0-source/thirdparty/libjpeg
# rm -rf mupdf-1.17.0-source/thirdparty/openjpeg
# rm -rf mupdf-1.17.0-source/thirdparty/zlib
patch -Np1 -d mupdf-1.17.0-source < mupdf-1.17.0-shared_libs-1.patch
USE_SYSTEM_LIBS=yes $(MAKE) -C mupdf-1.17.0-source build=release
USE_SYSTEM_LIBS=yes $(MAKE) -C mupdf-1.17.0-source prefix=/usr build=release docdir=/usr/share/doc/mupdf-1.17.0 install
tar xf mupdf-1.18.0-source.tar.gz
rm -rf mupdf-1.18.0-source/thirdparty/curl
rm -rf mupdf-1.18.0-source/thirdparty/freetype
rm -rf mupdf-1.18.0-source/thirdparty/harfbuzz
rm -rf mupdf-1.18.0-source/thirdparty/libjpeg
rm -rf mupdf-1.18.0-source/thirdparty/openjpeg
rm -rf mupdf-1.18.0-source/thirdparty/zlib
patch -Np1 -d mupdf-1.18.0-source < mupdf-1.18.0-security_fix-1.patch
USE_SYSTEM_FREETYPE=yes USE_SYSTEM_HARFBUZZ=yes USE_SYSTEM_JBIG2DEC=no USE_SYSTEM_JPEGXR=no USE_SYSTEM_LCMS2=no USE_SYSTEM_LIBJPEG=yes USE_SYSTEM_MUJS=no USE_SYSTEM_OPENJPEG=yes USE_SYSTEM_ZLIB=yes USE_SYSTEM_GLUT=no USE_SYSTEM_CURL=yes USE_SYSTEM_GUMBO=no XCFLAGS=-fPIC $(MAKE) -C mupdf-1.18.0-source build=release shared=yes
USE_SYSTEM_FREETYPE=yes USE_SYSTEM_HARFBUZZ=yes USE_SYSTEM_JBIG2DEC=no USE_SYSTEM_JPEGXR=no USE_SYSTEM_LCMS2=no USE_SYSTEM_LIBJPEG=yes USE_SYSTEM_MUJS=no USE_SYSTEM_OPENJPEG=yes USE_SYSTEM_ZLIB=yes USE_SYSTEM_GLUT=no USE_SYSTEM_CURL=yes USE_SYSTEM_GUMBO=no XCFLAGS=-fPIC $(MAKE) -C mupdf-1.18.0-source prefix=/usr shared=yes docdir=/usr/share/doc/mupdf-1.18.0 install
chmod 755 /usr/lib/libmupdf.so
ln -sfv mupdf-x11 /usr/bin/mupdf
rm -rf mupdf-1.17.0-source
rm -rf mupdf-1.18.0-source
diff -uNr mupdf-1.17.0/Makefile mupdf-1.17.0-shared_libs-1/Makefile
--- mupdf-1.17.0/Makefile 2020-05-05 20:59:09.000000000 +0930
+++ mupdf-1.17.0-shared_libs-1/Makefile 2021-07-29 11:23:04.802231128 +0930
@@ -20,7 +20,7 @@
# Do not specify CFLAGS or LIBS on the make invocation line - specify
# XCFLAGS or XLIBS instead. Make ignores any lines in the makefile that
# set a variable that was set on the command line.
-CFLAGS += $(XCFLAGS) -Iinclude
+CFLAGS += $(XCFLAGS) -Iinclude -fPIC
LIBS += $(XLIBS) -lm
ifneq ($(threading),no)
@@ -189,17 +189,21 @@
# --- Library ---
-MUPDF_LIB = $(OUT)/libmupdf.a
-THIRD_LIB = $(OUT)/libmupdf-third.a
-THREAD_LIB = $(OUT)/libmupdf-threads.a
-PKCS7_LIB = $(OUT)/libmupdf-pkcs7.a
+MUPDF_LIB = $(OUT)/libmupdf.so
+THIRD_LIB = $(OUT)/libmupdf-third.so
+THREAD_LIB = $(OUT)/libmupdf-threads.so
+PKCS7_LIB = $(OUT)/libmupdf-pkcs7.so
-$(MUPDF_LIB) : $(MUPDF_OBJ)
+$(MUPDF_LIB) : $(MUPDF_OBJ) $(THIRD_LIB) $(THREAD_LIB)
+ $(LINK_CMD) -shared -Wl,-soname -Wl,libmupdf.so -Wl,--no-undefined $(THIRD_LIBS)
$(THIRD_LIB) : $(THIRD_OBJ)
+ $(LINK_CMD) -shared -Wl,-soname -Wl,libmupdf-third.so -Wl,--no-undefined
$(THREAD_LIB) : $(THREAD_OBJ)
+ $(LINK_CMD) -shared -Wl,-soname -Wl,libmupdf-threads.so -Wl,--no-undefined -lpthread
$(PKCS7_LIB) : $(PKCS7_OBJ)
+ $(LINK_CMD) -shared -Wl,-soname -Wl,libmupfs-pkcs7.so
-INSTALL_LIBS := $(MUPDF_LIB) $(THIRD_LIB)
+INSTALL_LIBS := $(MUPDF_LIB) $(THIRD_LIB) $(THREAD_LIB) $(PKCS7_LIB)
# --- Main tools and viewers ---
diff -uNr mupdf-1.17.0/Makethird mupdf-1.17.0-shared_libs-1/Makethird
--- mupdf-1.17.0/Makethird 2020-05-05 20:59:09.000000000 +0930
+++ mupdf-1.17.0-shared_libs-1/Makethird 2021-07-29 11:23:04.802231128 +0930
@@ -3,9 +3,9 @@
ifeq ($(USE_SYSTEM_LIBS),yes)
USE_SYSTEM_FREETYPE := yes
USE_SYSTEM_HARFBUZZ := yes
- USE_SYSTEM_JBIG2DEC := yes
+ USE_SYSTEM_JBIG2DEC := no
USE_SYSTEM_JPEGXR := no # not available
- USE_SYSTEM_LCMS2 := no # lcms2mt is strongly preferred
+ USE_SYSTEM_LCMS2 := yes # lcms2mt is strongly preferred
USE_SYSTEM_LIBJPEG := yes
USE_SYSTEM_MUJS := no # not available
USE_SYSTEM_OPENJPEG := yes
Submitted By: Ken Moffat <ken at linuxfromscratch dot org>
Date: 2021-03-10
Initial Package Version: 1.18.0
Upstream Status: Applied
Origin: Upstream
Description: Fixes CVE-2021-3407
From: Robin Watts <Robin.Watts@artifex.com>
Date: Fri, 22 Jan 2021 17:05:15 +0000 (+0000)
Subject: Bug 703366: Fix double free of object during linearization.
X-Git-Url: http://git.ghostscript.com/?p=mupdf.git;a=commitdiff_plain;h=cee7cefc610d42fd383b3c80c12cbc675443176a;hp=fb9eb3322d0564cdf1e7e11fb7647641785ef93b
Bug 703366: Fix double free of object during linearization.
This appears to happen because we parse an illegal object from
a broken file and assign it to object 0, which is defined to
be free.
Here, we fix the parsing code so this can't happen.
---
diff --git a/source/pdf/pdf-parse.c b/source/pdf/pdf-parse.c
index 7abc8c3d4..5761c3351 100644
--- a/source/pdf/pdf-parse.c
+++ b/source/pdf/pdf-parse.c
@@ -749,6 +749,12 @@ pdf_parse_ind_obj(fz_context *ctx, pdf_document *doc,
fz_throw(ctx, FZ_ERROR_SYNTAX, "expected generation number (%d ? obj)", num);
}
gen = buf->i;
+ if (gen < 0 || gen >= 65536)
+ {
+ if (try_repair)
+ *try_repair = 1;
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "invalid generation number (%d)", gen);
+ }
tok = pdf_lex(ctx, file, buf);
if (tok != PDF_TOK_OBJ)
diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c
index 1b2bdcd59..30197b4b8 100644
--- a/source/pdf/pdf-xref.c
+++ b/source/pdf/pdf-xref.c
@@ -1190,6 +1190,8 @@ pdf_read_new_xref(fz_context *ctx, pdf_document *doc, pdf_lexbuf *buf)
{
ofs = fz_tell(ctx, doc->file);
trailer = pdf_parse_ind_obj(ctx, doc, doc->file, buf, &num, &gen, &stm_ofs, NULL);
+ if (num == 0)
+ fz_throw(ctx, FZ_ERROR_GENERIC, "Trailer object number cannot be 0\n");
}
fz_catch(ctx)
{
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment