Bug 987463

Summary: Cannot add a child to a node that uses ri-records (hivex_node_add_child: Assertion `old_offs != 0' failed.)
Product: [Fedora] Fedora Reporter: Richard W.M. Jones <rjones>
Component: hivexAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: mbooth, rjones
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: hivex-1.3.8-1.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-07-25 22:34:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 986473    

Description Richard W.M. Jones 2013-07-23 12:37:16 UTC
Description of problem:

hivex segfaults with an assert fail if you try to add a child
node to certain registry keys.  I have a test registry (which
I cannot release) which exhibits this problem:

  $ hivexsh -w SYSTEM

  Welcome to hivexsh, the hivex interactive shell for examining
  Windows Registry binary hive files.
  
  Type: 'help' for help summary
        'quit' to quit the shell
  
  SYSTEM\> cd \ControlSet001\Control\CriticalDeviceDatabase
  SYSTEM\ControlSet001\Control\CriticalDeviceDatabase> add pci#ven_1af4&dev_1001&subsys_00000000
  hivexsh: hivex.c:2476: hivex_node_add_child: Assertion `old_offs != 0' failed.
  Aborted (core dumped)

(3) hivexsh will segfault and (if configured right) will core dump.

The stack trace is:

#0  0x0000003f2ca35a19 in __GI_raise (sig=sig@entry=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x0000003f2ca37128 in __GI_abort () at abort.c:90
#2  0x0000003f2ca2e986 in __assert_fail_base (
    fmt=0x3f2cb7d3e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x3f3ae0a6e8 "old_offs != 0", 
    file=file@entry=0x3f3ae0a64d "hivex.c", line=line@entry=2476, 
    function=function@entry=0x3f3ae0cc00 <__PRETTY_FUNCTION__.6331> "hivex_node_add_child") at assert.c:92
#3  0x0000003f2ca2ea32 in __GI___assert_fail (
    assertion=assertion@entry=0x3f3ae0a6e8 "old_offs != 0", 
    file=file@entry=0x3f3ae0a64d "hivex.c", line=line@entry=2476, 
    function=function@entry=0x3f3ae0cc00 <__PRETTY_FUNCTION__.6331> "hivex_node_add_child") at assert.c:101
#4  0x0000003f3ae05dd2 in hivex_node_add_child (h=h@entry=0xf19030, 
    parent=119928, 
    name=name@entry=0xf2ccc4 "pci#ven_1af4&dev_1001&subsys_00000000")
    at hivex.c:2476
#5  0x0000000000402270 in cmd_add (
    name=0xf2ccc4 "pci#ven_1af4&dev_1001&subsys_00000000") at hivexsh.c:1099
#6  dispatch (args=0xf2ccc4 "pci#ven_1af4&dev_1001&subsys_00000000", 
    cmd=0xf2ccc0 "add") at hivexsh.c:424
#7  main (argc=<optimized out>, argv=<optimized out>) at hivexsh.c:214

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

hivex 1.3.7 & hivex from git both test, both fail

How reproducible:

100%

Steps to Reproduce:

(Will come later once I have a scrubbed registry which
I can release).

Comment 1 Richard W.M. Jones 2013-07-25 10:39:49 UTC
19 part patch posted upstream:

https://www.redhat.com/archives/libguestfs/2013-July/thread.html#00026

Comment 2 Richard W.M. Jones 2013-07-25 22:34:45 UTC
This should be fixed in hivex 1.3.8 which is available here:
http://libguestfs.org/download/hivex/
and in Fedora Rawhide.

Comment 3 Fedora Update System 2013-07-26 08:46:58 UTC
hivex-1.3.8-1.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/hivex-1.3.8-1.fc19

Comment 4 Fedora Update System 2013-08-03 23:59:43 UTC
hivex-1.3.8-1.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.