CInv::GetCommand(): type=1373179482 unknown type #9110

issue rebroad opened this issue on November 9, 2016
  1. rebroad commented at 8:41 AM on November 9, 2016: contributor

    It seems that bitcoin{d,-qt} can be crashed by being sent an inv of an unknown type. At least, it caused mine to:-

    2016-11-08 00:45:36.470 ProcessMessages(getdata, 397 bytes): CHECKSUM ERROR expected=6d9dbcdf was=a1046737 peer=39585
    2016-11-08 00:45:36.481 
    
    ************************
    EXCEPTION: St12out_of_range       
    CInv::GetCommand(): type=1373179482 unknown type       
    bitcoin in ProcessMessages()       
    
    2016-11-08 00:45:36.482 ProcessMessages(getdata, 397 bytes) FAILED peer=39585
    2016-11-08 00:45:36.487 
    
    ************************
    EXCEPTION: St12out_of_range       
    CInv::GetCommand(): type=1373179482 unknown type       
    bitcoin in msghand       
    
    

    If the throw std::out_of_range(strprintf("CInv::GetCommand(): type=%d unknown type", type)); in protocol.cpp supposed to cause the program to end?

  2. laanwj commented at 9:41 AM on November 9, 2016: member

    I'm able to reproduce this error in the log by enabling debug=net and sending an invalid inv type:

    2016-11-09 09:40:27 
    
    ************************
    EXCEPTION: St12out_of_range       
    CInv::GetCommand(): type=666 unknown type       
    bitcoin in ProcessMessages()       
    
    2016-11-09 09:40:27 ProcessMessages(inv, 37 bytes) FAILED peer=7
    

    However the exception is caught and printed, the process does not crash. It also appears without debug=net.

    Having a ToString function raise an exception is kind of unexpected. I think we should change CInv::ToString to catch the exception and return something like unknown: %d instead, for better troubleshooting. But it does not result in a crash right now.

  3. laanwj added the label Docs and Output on Nov 9, 2016
  4. laanwj added the label P2P on Nov 9, 2016
  5. laanwj referenced this in commit e5229290e5 on Nov 9, 2016
  6. laanwj referenced this in commit e9f25ddd00 on Nov 9, 2016
  7. paveljanik commented at 10:35 AM on November 9, 2016: contributor

    @rebroad: so what "to cause the program to end?"? Was it some local change on your side? Did bitcoind really stopped at all?

  8. laanwj closed this on Nov 11, 2016

  9. michelvankessel referenced this in commit 46a04a59d2 on Jan 3, 2019
  10. lateminer referenced this in commit 9967625e34 on Jan 3, 2019
  11. MarcoFalke 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-13 18:15 UTC

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