summaryrefslogtreecommitdiff
path: root/gnu/packages/patches
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2020-01-09 22:37:10 +0100
committerMarius Bakke <mbakke@fastmail.com>2020-01-14 00:18:09 +0100
commit1f2ef813fccd38a81c186d2e664c05038fc674e4 (patch)
tree7dff305a67c26e79d8f3fb811dcd9b9aff227863 /gnu/packages/patches
parentcebe07775bb3e16d41f75b2161a56da84937c7bd (diff)
gnu: texlive-bin: Update to 20190410.
* gnu/packages/patches/texlive-bin-CVE-2018-17407.patch, gnu/packages/patches/texlive-bin-luatex-poppler-compat.patch: Delete files. * gnu/packages/patches/texlive-bin-poppler-0.83.patch: New file. * gnu/local.mk (dist_patch_DATA): Adjust accordingly. * gnu/packages/tex.scm (texlive-extra-src): Update to 20190419. (texlive-bin): Likewise. [source](patches): Update Arch patches for Poppler 0.84 compatibility. [arguments]: Remove phase 'use-code-for-even-newer-poppler'; add phase 'patch-dvisgm-build-files'.
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r--gnu/packages/patches/texlive-bin-CVE-2018-17407.patch249
-rw-r--r--gnu/packages/patches/texlive-bin-luatex-poppler-compat.patch293
-rw-r--r--gnu/packages/patches/texlive-bin-poppler-0.83.patch52
3 files changed, 52 insertions, 542 deletions
diff --git a/gnu/packages/patches/texlive-bin-CVE-2018-17407.patch b/gnu/packages/patches/texlive-bin-CVE-2018-17407.patch
deleted file mode 100644
index 63646d420c..0000000000
--- a/gnu/packages/patches/texlive-bin-CVE-2018-17407.patch
+++ /dev/null
@@ -1,249 +0,0 @@
-This patch adds support for newer versions of Poppler and some upstream
-TexLive fixes, including one for CVE-2018-17407.
-
-It is taken from Linux From Scratch:
-<http://www.linuxfromscratch.org/patches/blfs/svn/texlive-20180414-source-upstream_fixes-3.patch>.
-
-Submitted By: Ken Moffat <ken at linuxfromscratch dot org>
-Date: 2018-12-26
-Initial Package Version: 20180414
-Upstream Status: Applied
-Origin: Upstream
-Description: Two fixes, cherry-picked from svn plus a CVE fix.
-I have removed the partial fixes for various system versions of poppler.
-
-r47469 Fix segfault in dvipdfm-x (XeTeX) on 1/2/4-bit transparent indexed PNGs.
-
-r47477 Fix a ptex regression for discontinuous kinsoku table.
-
-Also, via fedora (I got lost in svn) a critical fix for CVE-2018-17407
-
-"A buffer overflow in the handling of Type 1 fonts allows arbitrary code
-execution when a malicious font is loaded by one of the vulnerable tools:
-pdflatex, pdftex, dvips, or luatex."
-
-diff -Naur a/texk/dvipdfm-x/pngimage.c b/texk/dvipdfm-x/pngimage.c
---- a/texk/dvipdfm-x/pngimage.c 2018-02-17 08:41:35.000000000 +0000
-+++ b/texk/dvipdfm-x/pngimage.c 2018-10-09 01:52:01.648670875 +0100
-@@ -964,12 +964,16 @@
- png_bytep trans;
- int num_trans;
- png_uint_32 i;
-+ png_byte bpc, mask, shift;
-
- if (!png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS) ||
- !png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, NULL)) {
- WARN("%s: PNG does not have valid tRNS chunk but tRNS is requested.", PNG_DEBUG_STR);
- return NULL;
- }
-+ bpc = png_get_bit_depth(png_ptr, info_ptr);
-+ mask = 0xff >> (8 - bpc);
-+ shift = 8 - bpc;
-
- smask = pdf_new_stream(STREAM_COMPRESS);
- dict = pdf_stream_dict(smask);
-@@ -981,7 +985,8 @@
- pdf_add_dict(dict, pdf_new_name("ColorSpace"), pdf_new_name("DeviceGray"));
- pdf_add_dict(dict, pdf_new_name("BitsPerComponent"), pdf_new_number(8));
- for (i = 0; i < width*height; i++) {
-- png_byte idx = image_data_ptr[i];
-+ /* data is packed for 1/2/4 bpc formats, msb first */
-+ png_byte idx = (image_data_ptr[bpc * i / 8] >> (shift - bpc * i % 8)) & mask;
- smask_data_ptr[i] = (idx < num_trans) ? trans[idx] : 0xff;
- }
- pdf_add_stream(smask, (char *)smask_data_ptr, width*height);
-diff -Naur a/texk/dvipsk/writet1.c b/texk/dvipsk/writet1.c
---- a/texk/dvipsk/writet1.c 2016-11-25 18:24:26.000000000 +0000
-+++ b/texk/dvipsk/writet1.c 2018-10-09 01:52:01.648670875 +0100
-@@ -1449,7 +1449,9 @@
- *(strend(t1_buf_array) - 1) = ' ';
-
- t1_getline();
-+ alloc_array(t1_buf, strlen(t1_line_array) + strlen(t1_buf_array) + 1, T1_BUF_SIZE);
- strcat(t1_buf_array, t1_line_array);
-+ alloc_array(t1_line, strlen(t1_buf_array) + 1, T1_BUF_SIZE);
- strcpy(t1_line_array, t1_buf_array);
- t1_line_ptr = eol(t1_line_array);
- }
-diff -Naur a/texk/web2c/luatexdir/font/writet1.w b/texk/web2c/luatexdir/font/writet1.w
---- a/texk/web2c/luatexdir/font/writet1.w 2016-11-25 18:24:34.000000000 +0000
-+++ b/texk/web2c/luatexdir/font/writet1.w 2018-10-09 01:52:01.648670875 +0100
-@@ -1625,7 +1625,9 @@
- if (sscanf(p, "%i", &i) != 1) {
- strcpy(t1_buf_array, t1_line_array);
- t1_getline();
-+ alloc_array(t1_buf, strlen(t1_line_array) + strlen(t1_buf_array) + 1, T1_BUF_SIZE);
- strcat(t1_buf_array, t1_line_array);
-+ alloc_array(t1_line, strlen(t1_buf_array) + 1, T1_BUF_SIZE);
- strcpy(t1_line_array, t1_buf_array);
- t1_line_ptr = eol(t1_line_array);
- }
-diff -Naur a/texk/web2c/luatexdir/image/pdftoepdf.w b/texk/web2c/luatexdir/image/pdftoepdf.w
---- a/texk/web2c/luatexdir/image/pdftoepdf.w 2018-01-17 18:00:12.000000000 +0000
-+++ b/texk/web2c/luatexdir/image/pdftoepdf.w 2018-10-09 01:52:01.648670875 +0100
-@@ -472,10 +472,10 @@
- break;
- */
- case objString:
-- copyString(pdf, obj->getString());
-+ copyString(pdf, (GooString *)obj->getString());
- break;
- case objName:
-- copyName(pdf, obj->getName());
-+ copyName(pdf, (char *)obj->getName());
- break;
- case objNull:
- pdf_add_null(pdf);
-diff -Naur a/texk/web2c/luatexdir/lua/lepdflib.cc b/texk/web2c/luatexdir/lua/lepdflib.cc
---- a/texk/web2c/luatexdir/lua/lepdflib.cc 2018-02-14 14:44:38.000000000 +0000
-+++ b/texk/web2c/luatexdir/lua/lepdflib.cc 2018-10-09 01:52:01.649670868 +0100
-@@ -674,7 +674,7 @@
- uin = (udstruct *) luaL_checkudata(L, 1, M_##in); \
- if (uin->pd != NULL && uin->pd->pc != uin->pc) \
- pdfdoc_changed_error(L); \
-- gs = ((in *) uin->d)->function(); \
-+ gs = (GooString *)((in *) uin->d)->function(); \
- if (gs != NULL) \
- lua_pushlstring(L, gs->getCString(), gs->getLength()); \
- else \
-@@ -1813,7 +1813,7 @@
- if (uin->pd != NULL && uin->pd->pc != uin->pc)
- pdfdoc_changed_error(L);
- if (((Object *) uin->d)->isString()) {
-- gs = ((Object *) uin->d)->getString();
-+ gs = (GooString *)((Object *) uin->d)->getString();
- lua_pushlstring(L, gs->getCString(), gs->getLength());
- } else
- lua_pushnil(L);
-diff -Naur a/texk/web2c/pdftexdir/writet1.c b/texk/web2c/pdftexdir/writet1.c
---- a/texk/web2c/pdftexdir/writet1.c 2016-11-25 18:24:37.000000000 +0000
-+++ b/texk/web2c/pdftexdir/writet1.c 2018-10-09 01:52:01.649670868 +0100
-@@ -1598,7 +1598,9 @@
- *(strend(t1_buf_array) - 1) = ' ';
-
- t1_getline();
-+ alloc_array(t1_buf, strlen(t1_line_array) + strlen(t1_buf_array) + 1, T1_BUF_SIZE);
- strcat(t1_buf_array, t1_line_array);
-+ alloc_array(t1_line, strlen(t1_buf_array) + 1, T1_BUF_SIZE);
- strcpy(t1_line_array, t1_buf_array);
- t1_line_ptr = eol(t1_line_array);
- }
-diff -Naur a/texk/web2c/ptexdir/ptex_version.h b/texk/web2c/ptexdir/ptex_version.h
---- a/texk/web2c/ptexdir/ptex_version.h 2018-01-21 03:48:06.000000000 +0000
-+++ b/texk/web2c/ptexdir/ptex_version.h 2018-10-09 01:52:01.649670868 +0100
-@@ -1 +1 @@
--#define PTEX_VERSION "p3.8.0"
-+#define PTEX_VERSION "p3.8.1"
-diff -Naur a/texk/web2c/ptexdir/tests/free_ixsp.tex b/texk/web2c/ptexdir/tests/free_ixsp.tex
---- a/texk/web2c/ptexdir/tests/free_ixsp.tex 1970-01-01 01:00:00.000000000 +0100
-+++ b/texk/web2c/ptexdir/tests/free_ixsp.tex 2018-10-09 01:52:01.649670868 +0100
-@@ -0,0 +1,53 @@
-+%#!eptex -ini -etex
-+\let\dump\relax
-+\batchmode
-+\input plain
-+
-+\errorstopmode
-+\catcode`@=11
-+\newcount\@tempcnta
-+\newcount\@tempcntb
-+\newcount\@tempcntc
-+\mathchardef\LIM=256
-+
-+\def\MYCHAR#1{%
-+ \@tempcntc=\numexpr7*#1+"101\relax
-+ \@tempcnta=\@tempcntc\divide\@tempcnta 94
-+ \@tempcntb=\numexpr\@tempcntc-94*\@tempcnta+1\relax
-+ \ifnum\@tempcntb<0\advance\@tempcntb94 \advance\@tempcnta-1\fi
-+ \advance\@tempcnta18 % 18区以降
-+ \CNTA=\kuten\numexpr"100*\@tempcnta+\@tempcntb\relax
-+}
-+
-+\newcount\CNT\newcount\CNTA
-+\CNT=0
-+\loop
-+ \MYCHAR\CNT
-+ \message{\the\CNT.}
-+ \inhibitxspcode\CNTA=1\relax
-+ \advance\CNT1\relax
-+ \ifnum\CNT<\LIM
-+\repeat
-+
-+\newcount\CNTB
-+
-+\loop
-+ \MYCHAR\CNTB
-+ \global\inhibitxspcode\CNTA=3
-+{%
-+\CNT=0
-+\loop
-+ \MYCHAR\CNT
-+ \count@=\numexpr 1-\inhibitxspcode\CNTA\relax
-+ \ifnum\count@=0\else\ifnum\CNTB=\CNT\else
-+ \errmessage{<\the\CNTB, \the\CNT, \the\inhibitxspcode\CNTA>}\fi\fi
-+ \advance\CNT1\relax
-+ \ifnum\CNT<\LIM
-+\repeat
-+}
-+ \MYCHAR\CNTB
-+ \global\inhibitxspcode\CNTA=1\relax
-+ \advance\CNTB1\relax
-+ \ifnum\CNTB<\LIM
-+\repeat
-+\bye
-diff -Naur a/texk/web2c/ptexdir/tests/free_pena.tex b/texk/web2c/ptexdir/tests/free_pena.tex
---- a/texk/web2c/ptexdir/tests/free_pena.tex 1970-01-01 01:00:00.000000000 +0100
-+++ b/texk/web2c/ptexdir/tests/free_pena.tex 2018-10-09 01:52:01.649670868 +0100
-@@ -0,0 +1,52 @@
-+%#!eptex -ini -etex
-+\let\dump\relax
-+\batchmode
-+\input plain
-+
-+\errorstopmode
-+\catcode`@=11
-+\newcount\@tempcnta
-+\newcount\@tempcntb
-+\newcount\@tempcntc
-+\mathchardef\LIM=256
-+
-+\def\MYCHAR#1{%
-+ \@tempcntc=\numexpr7*#1+"101\relax
-+ \@tempcnta=\@tempcntc\divide\@tempcnta 94
-+ \@tempcntb=\numexpr\@tempcntc-94*\@tempcnta+1\relax
-+ \ifnum\@tempcntb<0\advance\@tempcntb94 \advance\@tempcnta-1\fi
-+ \advance\@tempcnta18 % 18区以降
-+ \CNTA=\kuten\numexpr"100*\@tempcnta+\@tempcntb\relax
-+}
-+
-+\newcount\CNT\newcount\CNTA
-+\CNT=0
-+\loop
-+ \MYCHAR\CNT
-+ \message{\the\CNT.}
-+ \prebreakpenalty\CNTA=\numexpr\CNT+1\relax
-+ \advance\CNT1\relax
-+ \ifnum\CNT<\LIM
-+\repeat
-+
-+\newcount\CNTB
-+
-+\loop
-+ \MYCHAR\CNTB
-+ \global\prebreakpenalty\CNTA=0
-+{%
-+\CNT=0
-+\loop
-+ \MYCHAR\CNT
-+ \count@=\numexpr -\CNT-1+\prebreakpenalty\CNTA\relax
-+ \ifnum\count@=0\else\ifnum\CNTB=\CNT\else\errmessage{<\the\CNTB, \the\CNT>}\fi\fi
-+ \advance\CNT1\relax
-+ \ifnum\CNT<\LIM
-+\repeat
-+}
-+ \MYCHAR\CNTB
-+ \global\prebreakpenalty\CNTA=\numexpr\CNTB+1\relax
-+ \advance\CNTB1\relax
-+ \ifnum\CNTB<\LIM
-+\repeat
-+\bye
diff --git a/gnu/packages/patches/texlive-bin-luatex-poppler-compat.patch b/gnu/packages/patches/texlive-bin-luatex-poppler-compat.patch
deleted file mode 100644
index 024ff416af..0000000000
--- a/gnu/packages/patches/texlive-bin-luatex-poppler-compat.patch
+++ /dev/null
@@ -1,293 +0,0 @@
-Fix LuaTeX compatibility with Poppler 0.75.
-
-Upstream LuaTeX have moved from Poppler to "pplib" and thus upstream
-fixes are unavailable. This is based on Archs patch, with minor
-tweaks to comply with texlive-bin-CVE-2018-17407.patch.
-https://git.archlinux.org/svntogit/packages.git/tree/trunk?h=packages/texlive-bin&id=418dd6f008c3d41a461353fdb60f2d73d87c58ed
-
-diff --git a/texk/web2c/luatexdir/image/pdftoepdf.w b/texk/web2c/luatexdir/image/pdftoepdf.w
---- a/texk/web2c/luatexdir/image/pdftoepdf.w
-+++ b/texk/web2c/luatexdir/image/pdftoepdf.w
-@@ -363,7 +363,7 @@ void copyReal(PDF pdf, double d)
-
- static void copyString(PDF pdf, GooString * string)
- {
-- char *p;
-+ const char *p;
- unsigned char c;
- size_t i, l;
- p = string->getCString();
-@@ -393,7 +393,7 @@ static void copyString(PDF pdf, GooString * string)
- pdf->cave = true;
- }
-
--static void copyName(PDF pdf, char *s)
-+static void copyName(PDF pdf, const char *s)
- {
- pdf_out(pdf, '/');
- for (; *s != 0; s++) {
-@@ -412,7 +412,7 @@ static void copyArray(PDF pdf, PdfDocument * pdf_doc, Array * array)
- Object obj1;
- pdf_begin_array(pdf);
- for (i = 0, l = array->getLength(); i < l; ++i) {
-- obj1 = array->getNF(i);
-+ obj1 = array->getNF(i).copy();
- copyObject(pdf, pdf_doc, &obj1);
- }
- pdf_end_array(pdf);
-@@ -425,7 +425,7 @@ static void copyDict(PDF pdf, PdfDocument * pdf_doc, Dict * dict)
- pdf_begin_dict(pdf);
- for (i = 0, l = dict->getLength(); i < l; ++i) {
- copyName(pdf, dict->getKey(i));
-- obj1 = dict->getValNF(i);
-+ obj1 = dict->getValNF(i).copy();
- copyObject(pdf, pdf_doc, &obj1);
- }
- pdf_end_dict(pdf);
-@@ -475,7 +475,7 @@ static void copyObject(PDF pdf, PdfDocument * pdf_doc, Object * obj)
- copyString(pdf, (GooString *)obj->getString());
- break;
- case objName:
-- copyName(pdf, (char *)obj->getName());
-+ copyName(pdf, obj->getName());
- break;
- case objNull:
- pdf_add_null(pdf);
-@@ -531,22 +531,22 @@ static PDFRectangle *get_pagebox(Page * page, int pagebox_spec)
- {
- switch (pagebox_spec) {
- case PDF_BOX_SPEC_MEDIA:
-- return page->getMediaBox();
-+ return (PDFRectangle *) page->getMediaBox();
- break;
- case PDF_BOX_SPEC_CROP:
-- return page->getCropBox();
-+ return (PDFRectangle *) page->getCropBox();
- break;
- case PDF_BOX_SPEC_BLEED:
-- return page->getBleedBox();
-+ return (PDFRectangle *) page->getBleedBox();
- break;
- case PDF_BOX_SPEC_TRIM:
-- return page->getTrimBox();
-+ return (PDFRectangle *) page->getTrimBox();
- break;
- case PDF_BOX_SPEC_ART:
-- return page->getArtBox();
-+ return (PDFRectangle *) page->getArtBox();
- break;
- default:
-- return page->getMediaBox();
-+ return (PDFRectangle *) page->getMediaBox();
- break;
- }
- }
-@@ -788,12 +788,12 @@ void write_epdf(PDF pdf, image_dict * idict, int suppress_optional_info)
- Now all relevant parts of the Page dictionary are copied. Metadata validity
- check is needed(as a stream it must be indirect).
- */
-- obj1 = pageDict->lookupNF("Metadata");
-+ obj1 = pageDict->lookupNF("Metadata").copy();
- if (!obj1.isNull() && !obj1.isRef())
- formatted_warning("pdf inclusion","/Metadata must be indirect object");
- /* copy selected items in Page dictionary */
- for (i = 0; pagedictkeys[i] != NULL; i++) {
-- obj1 = pageDict->lookupNF(pagedictkeys[i]);
-+ obj1 = pageDict->lookupNF(pagedictkeys[i]).copy();
- if (!obj1.isNull()) {
- pdf_add_name(pdf, pagedictkeys[i]);
- /* preserves indirection */
-@@ -806,13 +806,13 @@ void write_epdf(PDF pdf, image_dict * idict, int suppress_optional_info)
- PDF file, climbing up the tree until the Resources are found.
- (This fixes a problem with Scribus 1.3.3.14.)
- */
-- obj1 = pageDict->lookupNF("Resources");
-+ obj1 = pageDict->lookupNF("Resources").copy();
- if (obj1.isNull()) {
- op1 = &pagesobj1;
- op2 = &pagesobj2;
- *op1 = pageDict->lookup("Parent");
- while (op1->isDict()) {
-- obj1 = op1->dictLookupNF("Resources");
-+ obj1 = op1->dictLookupNF("Resources").copy();
- if (!obj1.isNull()) {
- pdf_add_name(pdf, "Resources");
- copyObject(pdf, pdf_doc, &obj1);
-diff --git a/texk/web2c/luatexdir/lua/lepdflib.cc b/texk/web2c/luatexdir/lua/lepdflib.cc
---- a/texk/web2c/luatexdir/lua/lepdflib.cc
-+++ b/texk/web2c/luatexdir/lua/lepdflib.cc
-@@ -240,7 +240,7 @@ static int l_new_Attribute(lua_State * L)
- if (uobj->pd != NULL && uobj->pd->pc != uobj->pc)
- pdfdoc_changed_error(L);
- uout = new_Attribute_userdata(L);
-- uout->d = new Attribute(n, nlen, (Object *)uobj->d);
-+ uout->d = new Attribute((GooString)n, (Object *)uobj->d);
- uout->atype = ALLOC_LEPDF;
- uout->pc = uobj->pc;
- uout->pd = uobj->pd;
-@@ -496,7 +496,7 @@ static int l_new_Object(lua_State * L)
- double numA = lua_tonumber(L,1);
- double genA = lua_tonumber(L,2);
- if ( ((numA)==(int)(numA)) && ((genA)==(int)(genA)) ){
-- uout->d = new Object((int)(numA), (int)(genA));
-+ uout->d = new Object({(int)(numA), (int)(genA)});
- uout->atype = ALLOC_LEPDF;
- uout->pc = 0;
- uout->pd = NULL;
-@@ -596,7 +596,7 @@ static int m_##in##_##function(lua_State * L) \
- uin = (udstruct *) luaL_checkudata(L, 1, M_##in); \
- if (uin->pd != NULL && uin->pd->pc != uin->pc) \
- pdfdoc_changed_error(L); \
-- o = ((in *) uin->d)->function(); \
-+ o = (out *) ((in *) uin->d)->function(); \
- if (o != NULL) { \
- uout = new_##out##_userdata(L); \
- uout->d = o; \
-@@ -889,7 +889,7 @@ static int m_Array_getNF(lua_State * L)
- if (i > 0 && i <= len) {
- uout = new_Object_userdata(L);
- uout->d = new Object();
-- *((Object *) uout->d) = ((Array *) uin->d)->getNF(i - 1);
-+ *((Object *) uout->d) = ((Array *) uin->d)->getNF(i - 1).copy();
- uout->atype = ALLOC_LEPDF;
- uout->pc = uin->pc;
- uout->pd = uin->pd;
-@@ -1125,12 +1125,12 @@ m_poppler_get_INT(Dict, getLength);
-
- static int m_Dict_add(lua_State * L)
- {
-- char *s;
-+ const char *s;
- udstruct *uin, *uobj;
- uin = (udstruct *) luaL_checkudata(L, 1, M_Dict);
- if (uin->pd != NULL && uin->pd->pc != uin->pc)
- pdfdoc_changed_error(L);
-- s = copyString(luaL_checkstring(L, 2));
-+ s = luaL_checkstring(L, 2);
- uobj = (udstruct *) luaL_checkudata(L, 3, M_Object);
- ((Dict *) uin->d)->add(s, std::move(*((Object *) uobj->d)));
- return 0;
-@@ -1190,7 +1190,7 @@ static int m_Dict_lookupNF(lua_State * L)
- s = luaL_checkstring(L, 2);
- uout = new_Object_userdata(L);
- uout->d = new Object();
-- *((Object *) uout->d) = ((Dict *) uin->d)->lookupNF(s);
-+ *((Object *) uout->d) = ((Dict *) uin->d)->lookupNF(s).copy();
- uout->atype = ALLOC_LEPDF;
- uout->pc = uin->pc;
- uout->pd = uin->pd;
-@@ -1263,7 +1263,7 @@ static int m_Dict_getValNF(lua_State * L)
- if (i > 0 && i <= len) {
- uout = new_Object_userdata(L);
- uout->d = new Object();
-- *((Object *) uout->d) = ((Dict *) uin->d)->getValNF(i - 1);
-+ *((Object *) uout->d) = ((Dict *) uin->d)->getValNF(i - 1).copy();
- uout->atype = ALLOC_LEPDF;
- uout->pc = uin->pc;
- uout->pd = uin->pd;
-@@ -1653,7 +1653,7 @@ static int m_Object_initRef(lua_State * L)
- pdfdoc_changed_error(L);
- num = luaL_checkint(L, 2);
- gen = luaL_checkint(L, 3);
-- *((Object *) uin->d) = Object(num, gen);
-+ *((Object *) uin->d) = Object({num, gen});
- return 0;
- }
-
-@@ -2011,7 +2011,7 @@ static int m_Object_arrayGetNF(lua_State * L)
- if (i > 0 && i <= len) {
- uout = new_Object_userdata(L);
- uout->d = new Object();
-- *((Object *) uout->d) = ((Object *) uin->d)->arrayGetNF(i - 1);
-+ *((Object *) uout->d) = ((Object *) uin->d)->arrayGetNF(i - 1).copy();
- uout->atype = ALLOC_LEPDF;
- uout->pc = uin->pc;
- uout->pd = uin->pd;
-@@ -2051,7 +2051,7 @@ static int m_Object_dictAdd(lua_State * L)
- pdfdoc_changed_error(L);
- if (!((Object *) uin->d)->isDict())
- luaL_error(L, "Object is not a Dict");
-- ((Object *) uin->d)->dictAdd(copyString(s), std::move(*((Object *) uobj->d)));
-+ ((Object *) uin->d)->dictAdd(s, std::move(*((Object *) uobj->d)));
- return 0;
- }
-
-@@ -2104,7 +2104,7 @@ static int m_Object_dictLookupNF(lua_State * L)
- if (((Object *) uin->d)->isDict()) {
- uout = new_Object_userdata(L);
- uout->d = new Object();
-- *((Object *) uout->d) = ((Object *) uin->d)->dictLookupNF(s);
-+ *((Object *) uout->d) = ((Object *) uin->d)->dictLookupNF(s).copy();
- uout->atype = ALLOC_LEPDF;
- uout->pc = uin->pc;
- uout->pd = uin->pd;
-@@ -2169,7 +2169,7 @@ static int m_Object_dictGetValNF(lua_State * L)
- if (i > 0 && i <= len) {
- uout = new_Object_userdata(L);
- uout->d = new Object();
-- *((Object *) uout->d) = ((Object *) uin->d)->dictGetValNF(i - 1);
-+ *((Object *) uout->d) = ((Object *) uin->d)->dictGetValNF(i - 1).copy();
- uout->atype = ALLOC_LEPDF;
- uout->pc = uin->pc;
- uout->pd = uin->pd;
-@@ -2470,7 +2470,7 @@ static int m_PDFDoc_getFileName(lua_State * L)
- uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc);
- if (uin->pd != NULL && uin->pd->pc != uin->pc)
- pdfdoc_changed_error(L);
-- gs = ((PdfDocument *) uin->d)->doc->getFileName();
-+ gs = (GooString *) ((PdfDocument *) uin->d)->doc->getFileName();
- if (gs != NULL)
- lua_pushlstring(L, gs->getCString(), gs->getLength());
- else
-@@ -2559,7 +2559,7 @@ static int m_PDFDoc_readMetadata(lua_State * L)
- if (uin->pd != NULL && uin->pd->pc != uin->pc)
- pdfdoc_changed_error(L);
- if (((PdfDocument *) uin->d)->doc->getCatalog()->isOk()) {
-- gs = ((PdfDocument *) uin->d)->doc->readMetadata();
-+ gs = (GooString *) ((PdfDocument *) uin->d)->doc->readMetadata();
- if (gs != NULL)
- lua_pushlstring(L, gs->getCString(), gs->getLength());
- else
-@@ -2577,7 +2577,7 @@ static int m_PDFDoc_getStructTreeRoot(lua_State * L)
- if (uin->pd != NULL && uin->pd->pc != uin->pc)
- pdfdoc_changed_error(L);
- if (((PdfDocument *) uin->d)->doc->getCatalog()->isOk()) {
-- obj = ((PdfDocument *) uin->d)->doc->getStructTreeRoot();
-+ obj = (StructTreeRoot *) ((PdfDocument *) uin->d)->doc->getStructTreeRoot();
- uout = new_StructTreeRoot_userdata(L);
- uout->d = obj;
- uout->pc = uin->pc;
---- texlive-source/texk/web2c/luatexdir/lua/lepdflib.cc.orig 2019-04-24 09:41:05.090522664 +0000
-+++ texlive-source/texk/web2c/luatexdir/lua/lepdflib.cc 2019-04-24 09:43:37.119184926 +0000
-@@ -994,7 +994,8 @@
- pdfdoc_changed_error(L);
- num = luaL_checkint(L, 2);
- gen = luaL_checkint(L, 3);
-- i = ((Catalog *) uin->d)->findPage(num, gen);
-+ Ref numgen = {num, gen};
-+ i = ((Catalog *) uin->d)->findPage(numgen);
- if (i > 0)
- lua_pushinteger(L, i);
- else
-@@ -2596,8 +2597,9 @@
- pdfdoc_changed_error(L);
- num = luaL_checkint(L, 2);
- gen = luaL_checkint(L, 3);
-+ Ref numgen = {num, gen};
- if (((PdfDocument *) uin->d)->doc->getCatalog()->isOk()) {
-- i = ((PdfDocument *) uin->d)->doc->findPage(num, gen);
-+ i = ((PdfDocument *) uin->d)->doc->findPage(numgen);
- if (i > 0)
- lua_pushinteger(L, i);
- else
---- texlive-source/texk/web2c/luatexdir/image/pdftoepdf.w.orig 2019-04-24 09:56:38.406498975 +0000
-+++ texlive-source/texk/web2c/luatexdir/image/pdftoepdf.w 2019-04-24 09:56:57.020081327 +0000
-@@ -630,7 +630,7 @@
- if (link == NULL || !link->isOk())
- formatted_error("pdf inclusion","invalid destination '%s'",img_pagename(idict));
- Ref ref = link->getPageRef();
-- img_pagenum(idict) = catalog->findPage(ref.num, ref.gen);
-+ img_pagenum(idict) = catalog->findPage(ref);
- if (img_pagenum(idict) == 0)
- formatted_error("pdf inclusion","destination is not a page '%s'",img_pagename(idict));
- delete link;
diff --git a/gnu/packages/patches/texlive-bin-poppler-0.83.patch b/gnu/packages/patches/texlive-bin-poppler-0.83.patch
new file mode 100644
index 0000000000..5e57e3efac
--- /dev/null
+++ b/gnu/packages/patches/texlive-bin-poppler-0.83.patch
@@ -0,0 +1,52 @@
+Fix build with Poppler 0.83 and later.
+
+Taken from Arch Linux, but adjusted to patch the versioned Poppler
+files, as upstream applies it after copying them in place.
+https://git.archlinux.org/svntogit/packages.git/tree/trunk/texlive-poppler-0.83.patch?h=packages/texlive-bin
+
+diff -ru texlive-source-orig/texk/web2c/pdftexdir/pdftoepdf-poppler0.76.0.cc texlive-source/texk/web2c/pdftexdir/pdftoepdf-poppler0.76.0.cc
+--- texlive-source-orig/texk/web2c/pdftexdir/pdftoepdf-poppler0.76.0.cc
++++ texlive-source/texk/web2c/pdftexdir/pdftoepdf-poppler0.76.0.cc
+@@ -723,7 +723,7 @@
+ #endif
+ // initialize
+ if (!isInit) {
+- globalParams = new GlobalParams();
++ globalParams.reset(new GlobalParams());
+ globalParams->setErrQuiet(false);
+ isInit = true;
+ }
+@@ -1108,6 +1108,5 @@
+ delete_document(p);
+ }
+ // see above for globalParams
+- delete globalParams;
+ }
+ }
+diff -ru texlive-source-orig/texk/web2c/pdftexdir/pdftosrc-poppler0.76.0.cc texlive-source/texk/web2c/pdftexdir/pdftosrc-poppler0.76.0.cc
+--- texlive-source-orig/texk/web2c/pdftexdir/pdftosrc-poppler0.76.0.cc
++++ texlive-source/texk/web2c/pdftexdir/pdftosrc-poppler0.76.0.cc
+@@ -79,7 +79,7 @@
+ exit(1);
+ }
+ fileName = new GString(argv[1]);
+- globalParams = new GlobalParams();
++ globalParams.reset(new GlobalParams());
+ doc = new PDFDoc(fileName);
+ if (!doc->isOk()) {
+ fprintf(stderr, "Invalid PDF file\n");
+@@ -100,7 +100,7 @@
+ if (objnum == 0) {
+ srcStream = catalogDict.dictLookup("SourceObject");
+ static char const_SourceFile[] = "SourceFile";
+- if (!srcStream.isStream(const_SourceFile)) {
++ if (!srcStream.isDict(const_SourceFile)) {
+ fprintf(stderr, "No SourceObject found\n");
+ exit(1);
+ }
+@@ -202,5 +202,4 @@
+ fprintf(stderr, "Cross-reference table extracted to %s\n", outname);
+ fclose(outfile);
+ delete doc;
+- delete globalParams;
+ }