Problems in file goo/GooString.cc
Submitted by fus..@..hoo.it
Assigned to poppler-bugs
Description
I'm using poppler 0.16.5. In one pdf with weird goto link entries (for example, in vi editor I see an entry "þÿ") the bsearch (row 677 of file poppler/Catalog.cc) for some value does not work correctly. I founded that the reason is a not totally correct implementation of methods "int GooString::cmp(GooString *str) const", "int GooString::cmpN(GooString *str, int n) const", "int GooString::cmp(const char *sA) const", and "int GooString::cmpN(const char *sA, int n) const". In each of these methods, the row "x = *p1 - *p2;" should be replaced with: "x = (unsigned char)*p1 - (unsigned char)*p2;"
The rows of file goo/GooString.cc that needs this replace are: 694, 711, 728, 748.
I founded that is fine too the use of strcmp and strncmp c library functions. E.g., "int GooString::cmp(GooString *str) const" could be simply implemented like this:
int GooString::cmp(GooString *str) const { return strcmp(s, str->s); }