Bug 739273 - Hivexml prints binary data in XML, causing Python Expat processing to fail
Summary: Hivexml prints binary data in XML, causing Python Expat processing to fail
Alias: None
Product: Fedora
Classification: Fedora
Component: hivex
Version: 15
Hardware: x86_64
OS: Linux
Target Milestone: ---
Assignee: Richard W.M. Jones
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2011-09-17 04:27 UTC by Alex Nelson
Modified: 2012-08-07 18:13 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2012-08-07 18:13:57 UTC

Attachments (Terms of Use)
Zip containing Python program and two hives on which hivexml produces output the Python program can't process. (6.68 MB, application/zip)
2011-09-17 04:27 UTC, Alex Nelson
no flags Details

Description Alex Nelson 2011-09-17 04:27:19 UTC
Created attachment 523677 [details]
Zip containing Python program and two hives on which hivexml produces output the Python program can't process.

Description of problem:

The node name data, value key data, and value text data is assumed to be printable.  Unfortunately, if that assumption is false arbitrary content is written to be interpreted as text.

Version-Release number of selected component (if applicable):

Git commit:  0a28041f4156878a74543966f9a72ed3d214ba44 (master as of Sep 6 2011)
Version: 1.3.1

How reproducible:

Precisely, in Fedora Core 15 environment.  Not tested in Ubuntu or non-Linux environments, but same problem is nearly guaranteed to occur there.

Steps to Reproduce:
To see a name character
1. Run: `hivexml charlie-2009-11-12.software.hive >out.xml`
2. Run: `simple_expat.py out.xml >out.txt`

1. Run: `hivexml terry-2009-12-02.software.hive >out.xml`
2. Run: `simple_expat.py out.xml >out.txt`

Actual results:

There is a Registered sign character, hex 0xae, in the hivexml output.  This causes the Python Expat processor to balk:
Traceback (most recent call last):
  File "/home/alex/local/scripts/simple_expat.py", line 24, in <module>
    p.ParseFile(open(sys.argv[1], "r"))
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 292, column 275590

It is visible immediately after the string:
node name="Indeo

Similarly, the terry hive dumps simply arbitrary binary data as part of a string list at line 8289, column 40040 in the hivexml output.  It follows the string:
key="Unchecked Task Count" value="250"/><value type="string-list" key="Autorecover MOFs"

Expected results:

Desired results are that Python's Expat processor simply read the value as unicode data or binary data and proceed with parsing.  That's out of scope of hivex.  Instead, having dangerous-to-print data come out in a safe text form is more desirable.

Additional info:

Base64 encoding completely resolves this problem, and is already applied elsewhere within the hivexml program.  Patch coming to the libguestfs mailing list.

Comment 1 Fedora End Of Life 2012-08-07 18:13:59 UTC
This message is a notice that Fedora 15 is now at end of life. Fedora
has stopped maintaining and issuing updates for Fedora 15. It is
Fedora's policy to close all bug reports from releases that are no
longer maintained. At this time, all open bugs with a Fedora 'version'
of '15' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that
we were unable to fix it before Fedora 15 reached end of life. If you
would still like to see this bug fixed and are able to reproduce it
against a later version of Fedora, you are encouraged to click on
"Clone This Bug" (top right of this page) and open it against that
version of Fedora.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

The process we are following is described here:

Note You need to log in before you can comment on or make changes to this bug.