Bug 5952 - PageLabelInfo::indexToLabel prepends UTF-16 BOM
Summary: PageLabelInfo::indexToLabel prepends UTF-16 BOM
Status: RESOLVED FIXED
Alias: None
Product: poppler
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: high critical
Assignee: poppler-bugs
QA Contact:
URL: http://www.universetoday.com/365days.pdf
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-19 05:30 UTC by Christian Persch (GNOME)
Modified: 2006-02-28 10:25 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Christian Persch (GNOME) 2006-02-19 05:30:26 UTC
Originally filed as evince bug http://bugzilla.gnome.org/show_bug.cgi?id=326129 .

With the testcase PDF [http://www.universetoday.com/365days.pdf], some page
labels contain data like this:

Breakpoint 2, poppler_page_get_property (object=0x83da148, prop_id=1,
value=0xbf8382e8, pspec=0x82b7938) at poppler-page.cc:753
753           g_value_set_string (value, label.getCString());
(gdb) x /4x label.s
0x83d9d30:      0xfe    0xff    0x69    0x00

i.e. this is an UTF-8 string with prepended UTF-16 BOM !

The code in glib/poppler-page.c is:
GooString label;
page->document->doc->getCatalog ()->indexToLabel (page->index, &label);
g_value_set_string (value, label.getCString());
Comment 1 Albert Astals Cid 2006-02-19 05:41:37 UTC
That GooString need to be changed to UGooString  
Comment 2 Christian Persch (GNOME) 2006-02-19 06:43:36 UTC
Hmm...

  GooString label;

  switch (prop_id)
    {
    case PROP_LABEL:
      page->document->doc->getCatalog ()->indexToLabel (page->index, &label);
      g_value_set_string (value, label.getCString());

page->document is PopplerDocument
->doc is PDFDoc *
->getCatalog() is Catalog *
and Catalog::indexToLabel takes a GooString not a UGooString, so this is *not* a
problem in the glib layer.

---
I've follow it further down to

PageLabelInfo::indexToLabel
where for index=4 (the fith call when opening the testcase with evince),
line 308: label->append(interval->prefix);
appends the BOM to |label|:

(gdb) x /2x interval->prefix
0x82cf2d0:      0xfe    0xff

so the problem is either that PageLabelInfo::indexToLabel appends the
interval->prefix unconverted, or that it is stored that way in ::prefix in the
first place (

-> back to general ?
Comment 3 Albert Astals Cid 2006-02-19 06:56:09 UTC
i just said  GooString needs to be changed to UGooString, obviously in the  
PageLabelInfo.  
  
I really did not want to change it to the glib frontend component, just a 
mistake  
there ;-)  
Comment 4 Kristian Høgsberg 2006-03-01 05:25:15 UTC
Fixed in cvs.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.