Skip to content

Commit 1a7226f

Browse files
author
Ethan Bishop
committed
Patch memory corruption bug in fontforge
This causes some PDFs with certain fonts to explode pdf2htmlEX, due to a incorrect malloc argument
1 parent 86f0431 commit 1a7226f

3 files changed

Lines changed: 15 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## 0.2.2
44

55
* Patch memory corruption bug due to PNG background images being the incorrect size.
6+
* Patch memory corruption bug in `fontforge` triggered by some fonts.
67

78
## 0.2.1
89

src/Pdf2Html/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ RUN patch ./poppler/glib/poppler-enums.c.template ./patches/poppler-enums.c.temp
3333
RUN patch ./poppler/glib/poppler-private.h ./patches/poppler-private.h.patch
3434
RUN ./buildScripts/buildPoppler
3535
RUN ./buildScripts/getFontforge
36+
RUN patch ./fontforge/fontforge/tottfgpos.c ./patches/fontforge-tottfgpos.c.patch
3637
RUN ./buildScripts/buildFontforge
3738
RUN ./buildScripts/buildPdf2htmlEX
3839
RUN ./buildScripts/installPdf2htmlEX
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@@ -2091,10 +2091,10 @@
2+
}
3+
4+
static uint16 *FigureInitialClasses(FPST *fpst) {
5+
- uint16 *initial = malloc((fpst->nccnt+1)*sizeof(uint16));
6+
+ uint16 *initial = malloc((fpst->rule_cnt+1)*sizeof(uint16));
7+
int i, cnt, j;
8+
9+
- initial[fpst->nccnt] = 0xffff;
10+
+ initial[fpst->rule_cnt] = 0xffff;
11+
for ( i=cnt=0; i<fpst->rule_cnt; ++i ) {
12+
for ( j=0; j<cnt ; ++j )
13+
if ( initial[j] == fpst->rules[i].u.class.nclasses[0] )

0 commit comments

Comments
 (0)