[arch-commits] Commit in texlive-bin/trunk (PKGBUILD texlive-poppler-0.59.patch)

2017-09-27 Thread Rémy Oudompheng
Date: Wednesday, September 27, 2017 @ 06:11:25
  Author: remy
Revision: 306258

upgpkg: texlive-bin 2017.44590-5

Fixes heap corruption resulting from double-free (FS#55720)

Modified:
  texlive-bin/trunk/PKGBUILD
  texlive-bin/trunk/texlive-poppler-0.59.patch

+
 PKGBUILD   |4 +--
 texlive-poppler-0.59.patch |   47 ---
 2 files changed, 24 insertions(+), 27 deletions(-)

Modified: PKGBUILD
===
--- PKGBUILD2017-09-26 19:28:42 UTC (rev 306257)
+++ PKGBUILD2017-09-27 06:11:25 UTC (rev 306258)
@@ -4,7 +4,7 @@
 
 pkgname=('texlive-bin' 'libsynctex')
 pkgver=2017.44590
-pkgrel=4
+pkgrel=5
 license=('GPL')
 arch=('i686' 'x86_64')
 makedepends=('cairo' 'pixman' 'graphite' 't1lib' 'gd' 'poppler'
@@ -17,7 +17,7 @@
 "texlive-poppler-0.59.patch")
 sha256sums=('4645b4d55fc500ba9be7156a6a330afb44fbf7fda40dfd73fe9cb16d207f2038'
 'ee97f3e07e235dee4ad6d0c3e85c2260914c965e94d5ffbf481fa506df5f01ec'
-'82703c2d8698e15ee9a8bed6eee1a7140dc48ea2f65a497ddf81f187df6e6832')
+'76bc0528da33b1f980f85464c95d00736d9997ba7f8d11475c88f03e099e91b0')
 
 prepare() {
 cd "$srcdir/source"

Modified: texlive-poppler-0.59.patch
===
--- texlive-poppler-0.59.patch  2017-09-26 19:28:42 UTC (rev 306257)
+++ texlive-poppler-0.59.patch  2017-09-27 06:11:25 UTC (rev 306258)
@@ -862,16 +862,18 @@
  pdf_puts(" ");
  copyObject();
  }
-@@ -612,7 +600,7 @@
+@@ -612,9 +600,8 @@
  copyDict(obj);
  pdf_puts(">>");
  } else if (obj->isStream()) {
 -initDictFromDict(obj1, obj->streamGetDict());
-+obj1 = Object(obj->streamGetDict());
  pdf_puts("<<\n");
- copyDict();
+-copyDict();
++copyDict(obj->getStream()->getDictObject());
  pdf_puts(">>\n");
-@@ -638,9 +626,8 @@
+ pdf_puts("stream\n");
+ copyStream(obj->getStream()->getUndecodedStream());
+@@ -638,9 +625,8 @@
  InObj *r;
  for (r = inObjList; r != 0; r = r->next) {
  if (!r->written) {
@@ -882,7 +884,7 @@
  if (r->type == objFont) {
  assert(!obj1.isStream());
  pdfbeginobj(r->num, 2); // \pdfobjcompresslevel = 2 
is for this
-@@ -656,7 +643,6 @@
+@@ -656,7 +642,6 @@
  pdf_puts("\n");
  pdfendobj();
  }
@@ -890,7 +892,7 @@
  }
  }
  }
-@@ -839,8 +825,8 @@
+@@ -839,8 +824,8 @@
  Page *page;
  Ref *pageRef;
  Dict *pageDict;
@@ -901,7 +903,7 @@
  bool writeSepGroup = false;
  Object info;
  char *key;
-@@ -867,8 +853,8 @@
+@@ -867,8 +852,8 @@
  encodingList = 0;
  page = pdf_doc->doc->getCatalog()->getPage(epdf_selected_page);
  pageRef = pdf_doc->doc->getCatalog()->getPageRef(epdf_selected_page);
@@ -912,7 +914,7 @@
  rotate = page->getRotate();
  PDFRectangle *pagebox;
  // write the Page header
-@@ -886,7 +872,7 @@
+@@ -886,7 +871,7 @@
  pdf_printf("/%s.PageNumber %i\n", pdfkeyprefix, (int) 
epdf_selected_page);
  }
  if ((suppress_ptex_info & MASK_SUPPRESS_PTEX_INFODICT) == 0) {
@@ -921,7 +923,7 @@
  if (info.isRef()) {
  // the info dict must be indirect (PDF Ref p. 61)
  pdf_printf("/%s.InfoDict ", pdfkeyprefix);
-@@ -942,14 +928,14 @@
+@@ -942,14 +927,14 @@
  pdf_puts(stripzeros(s));
  
  // Metadata validity check (as a stream it must be indirect)
@@ -940,7 +942,7 @@
  pdf_newline();
  pdf_printf("/%s ", pageDictKeys[i]);
  copyObject(); // preserves indirection
-@@ -957,8 +943,8 @@
+@@ -957,8 +942,8 @@
  } 
  
  // handle page group
@@ -951,7 +953,7 @@
  if (pdfpagegroupval == 0) { 
  // another pdf with page group was included earlier on the
  // same page; copy the Group entry as is.  See manual for
-@@ -972,11 +958,11 @@
+@@ -972,11 +957,11 @@
  copyObject();
  } else {
  // write Group dict as a separate object, since the Page dict 
also refers to it
@@ -966,29 +968,24 @@
  pdf_printf("/Group %ld 0 R\n", (long)pdfpagegroupval);
  }
  }
-@@ -989,15 +975,15 @@
+@@ -989,14 +974,14 @@
  pdftex_warn
  ("PDF inclusion: /Resources missing. 'This practice is not 
recommended' (PDF Ref)");
  } else {
 -initDictFromDict(obj1, page->getResourceDict());
--if (!obj1->isDict())
-+obj1 = Object(page->getResourceDict());
-+if (!obj1.isDict())
++Object *obj1 = page->getResourceDictObject();
+ if (!obj1->isDict())
  pdftex_fail("PDF inclusion: invalid resources dict type <%s>",
--obj1->getTypeName());
-+obj1.getTypeName());
+  

[arch-commits] Commit in texlive-bin/trunk (PKGBUILD texlive-poppler-0.59.patch)

2017-09-25 Thread Rémy Oudompheng
Date: Monday, September 25, 2017 @ 21:15:31
  Author: remy
Revision: 306228

upgpkg: texlive-bin 2017.44590-4

Fixes bug FS#55721

Modified:
  texlive-bin/trunk/PKGBUILD
  texlive-bin/trunk/texlive-poppler-0.59.patch

+
 PKGBUILD   |4 +-
 texlive-poppler-0.59.patch |   73 +--
 2 files changed, 45 insertions(+), 32 deletions(-)

Modified: PKGBUILD
===
--- PKGBUILD2017-09-25 19:48:58 UTC (rev 306227)
+++ PKGBUILD2017-09-25 21:15:31 UTC (rev 306228)
@@ -4,7 +4,7 @@
 
 pkgname=('texlive-bin' 'libsynctex')
 pkgver=2017.44590
-pkgrel=3
+pkgrel=4
 license=('GPL')
 arch=('i686' 'x86_64')
 makedepends=('cairo' 'pixman' 'graphite' 't1lib' 'gd' 'poppler'
@@ -17,7 +17,7 @@
 "texlive-poppler-0.59.patch")
 sha256sums=('4645b4d55fc500ba9be7156a6a330afb44fbf7fda40dfd73fe9cb16d207f2038'
 'ee97f3e07e235dee4ad6d0c3e85c2260914c965e94d5ffbf481fa506df5f01ec'
-'8ff387b417b4da920d6ffc3f3d89e52796334693cb88b97bf1770931bf2791e5')
+'82703c2d8698e15ee9a8bed6eee1a7140dc48ea2f65a497ddf81f187df6e6832')
 
 prepare() {
 cd "$srcdir/source"

Modified: texlive-poppler-0.59.patch
===
--- texlive-poppler-0.59.patch  2017-09-25 19:48:58 UTC (rev 306227)
+++ texlive-poppler-0.59.patch  2017-09-25 21:15:31 UTC (rev 306228)
@@ -720,16 +720,39 @@
  pdf_puts(" ");
  }
  pdf_puts("]\n");
-@@ -396,7 +359,7 @@
+@@ -394,10 +357,29 @@
  
+ #define REPLACE_TYPE1C true
+ 
++static bool embeddableFont(Object * fontdesc)
++{
++Object fontfile, ffsubtype;
++
++if (!fontdesc->isDict())
++return false;
++fontfile = fontdesc->dictLookup("FontFile");
++if (fontfile.isStream())
++return true;
++if (REPLACE_TYPE1C) {
++fontfile = fontdesc->dictLookup("FontFile3");
++if (!fontfile.isStream())
++return false;
++ffsubtype = fontfile.streamGetDict()->lookup("Subtype");
++return ffsubtype.isName() && !strcmp(ffsubtype.getName(), "Type1C");
++}
++return false;
++}
++
  static void copyFont(char *tag, Object * fontRef)
  {
 -PdfObject fontdict, subtype, basefont, fontdescRef, fontdesc, charset,
+-fontfile, ffsubtype, stemV;
 +Object fontdict, subtype, basefont, fontdescRef, fontdesc, charset,
- fontfile, ffsubtype, stemV;
++stemV;
  GfxFont *gfont;
  fd_entry *fd;
-@@ -413,33 +376,49 @@
+ fm_entry *fontmap;
+@@ -413,33 +395,39 @@
  }
  // Only handle included Type1 (and Type1C) fonts; anything else will be 
copied.
  // Type1C fonts are replaced by Type1 fonts, if REPLACE_TYPE1C is true.
@@ -747,6 +770,7 @@
 -&& !strcmp(ffsubtype->getName(), "Type1C")))
 -&& (fontmap = lookup_fontmap(basefont->getName())) != NULL) {
 +fontdict = fontRef->fetch(xref);
++fontdesc = Object(objNull);
 +if (fontdict.isDict()) {
 +subtype = fontdict.dictLookup("Subtype");
 +basefont = fontdict.dictLookup("BaseFont");
@@ -753,17 +777,6 @@
 +fontdescRef = fontdict.dictLookupNF("FontDescriptor");
 +if (fontdescRef.isRef()) {
 +fontdesc = fontdescRef.fetch(xref);
-+if (fontdesc.isDict()) {
-+fontfile = fontdesc.dictLookup("FontFile");
-+if (!fontfile.isStream() && REPLACE_TYPE1C) {
-+fontfile = fontdesc.dictLookup("FontFile3");
-+ffsubtype = fontfile.streamGetDict()->lookup("Subtype");
-+if (!(ffsubtype.isName() && !strcmp(ffsubtype.getName(), 
"Type1C"))) {
-+// not a Type1-C font.
-+fontfile = Object(objNull);
-+}
-+}
-+}
 +}
 +}
 +if (!fixedinclusioncopyfont && fontdict.isDict()
@@ -772,7 +785,7 @@
 +&& basefont.isName()
 +&& fontdescRef.isRef()
 +&& fontdesc.isDict()
-+&& fontfile.isStream()
++&& embeddableFont()
 +&& (fontmap = lookup_fontmap(basefont.getName())) != NULL) {
  // round /StemV value, since the PDF input is a float
  // (see Font Descriptors in PDF reference), but we only store an
@@ -799,7 +812,7 @@
  pdf_printf(" %d 0 R ", addFont(fontRef->getRef(), fd,
 addEncoding(gfont)));
  } else {
-@@ -451,24 +430,24 @@
+@@ -451,24 +439,24 @@
  
  static void copyFontResources(Object * obj)
  {
@@ -829,7 +842,7 @@
  }
  pdf_puts(">>\n");
  }
-@@ -557,7 +536,7 @@
+@@ -557,7 +545,7 @@
  
  static void copyObject(Object * obj)
  {
@@ -838,7 +851,7 @@
  int i, l, c;
  Ref ref;
  char *p;
-@@ -601,8 +580,8 @@
+@@ -601,8 +589,8 @@
  } else if (obj->isArray()) {
  pdf_puts("[");
  for (i = 0, l = obj->arrayGetLength(); i < 

[arch-commits] Commit in texlive-bin/trunk (PKGBUILD texlive-poppler-0.59.patch)

2017-09-19 Thread Rémy Oudompheng
Date: Tuesday, September 19, 2017 @ 19:10:51
  Author: remy
Revision: 305861

Rebuild for poppler 0.59

As poppler contains a large number of API changes,
this comes with a patch for pdftex and luatex.

Added:
  texlive-bin/trunk/texlive-poppler-0.59.patch
Modified:
  texlive-bin/trunk/PKGBUILD

+
 PKGBUILD   |   12 
 texlive-poppler-0.59.patch | 1132 +++
 2 files changed, 1141 insertions(+), 3 deletions(-)

Modified: PKGBUILD
===
--- PKGBUILD2017-09-19 17:32:25 UTC (rev 305860)
+++ PKGBUILD2017-09-19 19:10:51 UTC (rev 305861)
@@ -4,7 +4,7 @@
 
 pkgname=('texlive-bin' 'libsynctex')
 pkgver=2017.44590
-pkgrel=2
+pkgrel=3
 license=('GPL')
 arch=('i686' 'x86_64')
 makedepends=('cairo' 'pixman' 'graphite' 't1lib' 'gd' 'poppler'
@@ -13,9 +13,11 @@
  'perl' 'clisp' 'ffcall')
 url='http://tug.org/texlive/'
 
source=("http://mirrors.kernel.org/archlinux/other/texlive/texlive-bin-source-${pkgver}.tar.xz;
-"luatex-gcc7.patch")
+"luatex-gcc7.patch"
+"texlive-poppler-0.59.patch")
 sha256sums=('4645b4d55fc500ba9be7156a6a330afb44fbf7fda40dfd73fe9cb16d207f2038'
-'ee97f3e07e235dee4ad6d0c3e85c2260914c965e94d5ffbf481fa506df5f01ec')
+'ee97f3e07e235dee4ad6d0c3e85c2260914c965e94d5ffbf481fa506df5f01ec'
+'8ff387b417b4da920d6ffc3f3d89e52796334693cb88b97bf1770931bf2791e5')
 
 prepare() {
 cd "$srcdir/source"
@@ -28,6 +30,10 @@
 
 # Luatex crashes when compiled with GCC7.1
 patch -Np0 -i "${srcdir}/luatex-gcc7.patch"
+
+# Poppler 0.58 introduces API changes by hiding internal object
+# management.
+patch -Np1 -i "${srcdir}/texlive-poppler-0.59.patch"
 }
 
 build() {

Added: texlive-poppler-0.59.patch
===
--- texlive-poppler-0.59.patch  (rev 0)
+++ texlive-poppler-0.59.patch  2017-09-19 19:10:51 UTC (rev 305861)
@@ -0,0 +1,1132 @@
+diff -ur source.orig/texk/web2c/luatexdir/image/pdftoepdf.w 
source/texk/web2c/luatexdir/image/pdftoepdf.w
+--- source.orig/texk/web2c/luatexdir/image/pdftoepdf.w 2017-05-08 
22:39:36.639375783 +0200
 source/texk/web2c/luatexdir/image/pdftoepdf.w  2017-09-19 
11:23:36.586768739 +0200
+@@ -224,7 +224,7 @@
+ free(checksum);
+ }
+ if (pdf_doc->doc == NULL) {
+-docmemstream = new MemStream( docstream,0,streamsize, obj.initNull() 
);
++docmemstream = new MemStream( docstream,0,streamsize, Object(objNull) 
);
+ doc = new PDFDoc(docmemstream); /* takes ownership of docmemstream */
+ pdf_doc->pc++;
+ if (!doc->isOk() || !doc->okToPrint()) {
+@@ -408,9 +408,8 @@
+ Object obj1;
+ pdf_begin_array(pdf);
+ for (i = 0, l = array->getLength(); i < l; ++i) {
+-array->getNF(i, );
++obj1 = array->getNF(i);
+ copyObject(pdf, pdf_doc, );
+-obj1.free();
+ }
+ pdf_end_array(pdf);
+ }
+@@ -422,9 +421,8 @@
+ pdf_begin_dict(pdf);
+ for (i = 0, l = dict->getLength(); i < l; ++i) {
+ copyName(pdf, dict->getKey(i));
+-dict->getValNF(i, );
++obj1 = dict->getValNF(i);
+ copyObject(pdf, pdf_doc, );
+-obj1.free();
+ }
+ pdf_end_dict(pdf);
+ }
+@@ -510,13 +508,12 @@
+ PDFDoc *doc = pdf_doc->doc;
+ xref = doc->getXRef();
+ for (r = pdf_doc->inObjList; r != NULL;) {
+-xref->fetch(r->ref.num, r->ref.gen, );
++obj1 = xref->fetch(r->ref.num, r->ref.gen);
+ if (obj1.isStream())
+ pdf_begin_obj(pdf, r->num, OBJSTM_NEVER);
+ else
+ pdf_begin_obj(pdf, r->num, 2);
+ copyObject(pdf, pdf_doc, );
+-obj1.free();
+ pdf_end_obj(pdf);
+ n = r->next;
+ delete r;
+@@ -740,7 +737,7 @@
+ catalog = doc->getCatalog();
+ page = catalog->getPage(img_pagenum(idict));
+ pageref = catalog->getPageRef(img_pagenum(idict));
+-doc->getXRef()->fetch(pageref->num, pageref->gen, );
++pageobj = doc->getXRef()->fetch(pageref->num, pageref->gen);
+ pageDict = pageobj.getDict();
+ /* write the Page header */
+ pdf_begin_obj(pdf, img_objnum(idict), OBJSTM_NEVER);
+@@ -757,12 +754,11 @@
+ pdf_dict_add_int(pdf, "PTEX.PageNumber", (int) img_pagenum(idict));
+ }
+ if ((suppress_optional_info & 8) == 0) {
+-doc->getDocInfoNF();
++obj1 = doc->getDocInfoNF();
+ if (obj1.isRef()) {
+ /* the info dict must be indirect (PDF Ref p. 61) */
+ pdf_dict_add_ref(pdf, "PTEX.InfoDict", addInObj(pdf, pdf_doc, 
obj1.getRef()));
+ }
+-obj1.free();
+ }
+ if (img_is_bbox(idict)) {
+ bbox[0] = sp2bp(img_bbox(idict)[0]);
+@@ -788,19 +784,17 @@
+ Now all relevant parts of the Page dictionary are copied. Metadata 
validity
+ check is needed(as a stream