094ae9 Fix segfault on fingerprinting symlink round (RhBug:1660232)

1 file Authored by Panu Matilainen 4 years ago, Committed by ttomecek 4 years ago,
1 file changed. 5 lines added. 1 lines removed.
    Fix segfault on fingerprinting symlink round (RhBug:1660232)
    
    Both yum and dnf perform a test-transaction before the real thing,
    and both neglet to check for an error code from the test-transaction
    when there are no problem objects to return. Which can happen in
    some special cases, such a using different vsflags between initial
    package read and transaction (which is what both yum and dnf do),
    which can cause the in-transaction package open fail on corrupt packages.
    And when this failed transaction is fed back to rpmtsRun(), it
    segfaults in fingerprinting as the second loop of symlink checking
    doesn't check for NULL's element files like the first loop does.
    
    Add the missing NULL check and remove bogus "can't happen" comment to fix.
    
    FWIW, the scenario with different vsflags and corrupted packages doesn't
    happen by default in rpm >= 4.14.2, the corrupt package gets caught
    in the verify stage which does create problem objects and thus both
    yum and dnf abort as they should.
    
        
file modified
+5 -1