[poppler] poppler/TextOutputDev.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Tue Mar 25 14:29:43 PDT 2014


 poppler/TextOutputDev.cc |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 1d7095ab7bdf0f14c3bfe99d6d5985bce98abe16
Author: Albert Astals Cid <aacid at kde.org>
Date:   Tue Mar 25 22:29:07 2014 +0100

    Fix Heap-buffer-overflow in TextPage::updateFont
    
    Bug #76442

diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc
index 7c2ca78..7bf7012 100644
--- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc
@@ -2192,10 +2192,12 @@ void TextPage::updateFont(GfxState *state) {
     mCode = letterCode = anyCode = -1;
     for (code = 0; code < 256; ++code) {
       name = ((Gfx8BitFont *)gfxFont)->getCharName(code);
-      if (name && name[0] == 'm' && name[1] == '\0') {
+      int nameLen = name ? strlen(name) : 0;
+      GBool nameOneChar = nameLen == 1 || (nameLen > 1 && name[1] == '\0');
+      if (nameOneChar && name[0] == 'm') {
 	mCode = code;
       }
-      if (letterCode < 0 && name && name[1] == '\0' &&
+      if (letterCode < 0 && nameOneChar &&
 	  ((name[0] >= 'A' && name[0] <= 'Z') ||
 	   (name[0] >= 'a' && name[0] <= 'z'))) {
 	letterCode = code;


More information about the poppler mailing list