Bug report in "main.cpp" #4469

issue hophacker opened this issue on July 6, 2014
  1. hophacker commented at 12:26 AM on July 6, 2014: none

    In the following piece of code in "main.cpp", chainActive.Genesis() could return NULL, there's no branch doing this case. If chainActive.Genesis() returns NULL, the code will crash

    vStack.push_back(make_pair(0, chainActive.Genesis()));
    
    int nPrevCol = 0;
    int count = 0;
    while (!vStack.empty())
    {
        cout << count++ << endl;
        int nCol = vStack.back().first;
        CBlockIndex* pindex = vStack.back().second;
        vStack.pop_back();
    
  2. laanwj added the label UTXO Db and Indexes on Jul 7, 2014
  3. laanwj added the label Bug on Jul 7, 2014
  4. laanwj added the label Priority Medium on Jul 7, 2014
  5. laanwj removed the label Priority Medium on Jul 7, 2014
  6. laanwj added the label Priority Low on Jul 7, 2014
  7. paveljanik commented at 7:22 PM on November 26, 2014: contributor

    Hmm, why do you think it will crash? Just out of curiosity, I have replaced the call to Genesis() with NULL and it didn't crash here... ... time passes ... Hmm yes, it crashes here (you have to compile the file after change 8)). But this can't happen because we initialize genesis inside

    bool InitBlockIndex() {

  8. paveljanik commented at 7:45 PM on November 26, 2014: contributor

    So even you run that particular code without the blocks, ./bitcoind -printblocktree -testnet -debug -printtoconsole prints:

    ...
    init message: Verifying blocks...
     block index             608ms
    0 (blk00000.dat:0x8)  2011-02-02 23:16:42  tx 1
    ...
    

    ie. it doesn't fail - because the Genesis block is added.

  9. paveljanik commented at 12:32 PM on November 27, 2014: contributor

    The code got removed as part of #5385. This issue can be closed now.

  10. laanwj commented at 12:54 PM on November 27, 2014: member

    Hah. Deleting code is the best way to get rid of bugs.

  11. laanwj closed this on Nov 27, 2014

  12. 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-18 09:15 UTC

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