]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/gpdf/files/016_CAN-2005-2097-loca-table-sanity.patch
gpdf: add 2.10.0-4 from Debian.
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / gpdf / files / 016_CAN-2005-2097-loca-table-sanity.patch
1 --- gpdf-2.8.2.orig/fofi/FoFiTrueType.cc
2 +++ gpdf-2.8.2/fofi/FoFiTrueType.cc
3 @@ -1343,6 +1343,26 @@
4      return;
5    }
6  
7 +  // make sure the loca table is sane (correct length and entries are
8 +  // in bounds)
9 +  i = seekTable("loca");
10 +  if (tables[i].len < (nGlyphs + 1) * (locaFmt ? 4 : 2)) {
11 +    parsedOk = gFalse;
12 +    return;
13 +  }
14 +  for (j = 0; j <= nGlyphs; ++j) {
15 +    if (locaFmt) {
16 +      pos = (int)getU32BE(tables[i].offset + j*4, &parsedOk);
17 +    } else {
18 +      pos = getU16BE(tables[i].offset + j*2, &parsedOk);
19 +    }
20 +    if (pos < 0 || pos > len) {
21 +      parsedOk = gFalse;
22 +    }
23 +  }
24 +  if (!parsedOk) {
25 +    return;
26 +  }
27    // read the post table
28    readPostTable();
29    if (!parsedOk) {