Simplify storage of orphan transactions, fix CVE-2013-4627 #2871

pull gavinandresen wants to merge 2 commits into bitcoin:master from gavinandresen:simplify_maporphan changing 3 files +39 −70
  1. gavinandresen commented at 6:13 AM on August 2, 2013: contributor

    Orphan transactions were stored as a CDataStream pointer; this changes the mapOrphanTransactions data structures to store orphans as a CTransaction.

    This also fixes CVE-2013-4627 by always re-serializing transactions before relaying them.

    And I cleaned up the "tx" message-handling code a little (it was re-using 'inv' and 'tx' variables, which is error-prone and confusing).

    Tested by running against the main network with max orphans set to eleven, to exercise the add/remove/map overflow code.

  2. Revert "Truncate oversize 'tx' messages before relaying/storing."
    This reverts commit c40a5aaaf484855a4350fd702e8e72fd21a68155.
    8f6f92c72b
  3. Simplify storage of orphan transactions
    Orphan transactions were stored as a CDataStream pointer;
    this changes the mapOrphanTransactions data structures to
    store orphans as a CTransaction.
    
    This also fixes CVE-2013-4627 by always re-serializing
    transactions before relaying them.
    159bc48193
  4. BitcoinPullTester commented at 6:39 AM on August 2, 2013: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/159bc4819304c4394a92230c9e7b9f3416abe877 for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  5. SergioDemianLerner commented at 1:54 PM on August 2, 2013: contributor

    Seems ok to me.

  6. gavinandresen commented at 2:34 PM on August 2, 2013: contributor

    mapOrphanTransactions[hash] cannot be null; it will be initialized to an empty (default constructor) CTransaction when referenced. That should be impossible, because addOrphan/EraseOrphan keeps mapOrphanTransactions and mapOrphanTransactionsByPrev in sync. But even if some bug caused it to happen, if that default CTransaction made it out of the orphan list it would be rejected by the memory pool. If it got stuck in the orphan list... no big deal, it will eventually be evicted.

  7. sipa commented at 10:12 AM on August 5, 2013: member

    Haven't tested, but looks good to me.

  8. gavinandresen referenced this in commit ddd0e2f616 on Aug 7, 2013
  9. gavinandresen merged this on Aug 7, 2013
  10. gavinandresen closed this on Aug 7, 2013

  11. gavinandresen deleted the branch on Nov 4, 2013
  12. IntegralTeam referenced this in commit b322b4828e on Jun 4, 2019
  13. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-24 18:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me