citp / BlockSci

A high-performance tool for blockchain science and exploration
https://citp.github.io/BlockSci/
GNU General Public License v3.0
1.34k stars 259 forks source link

address_from_string("random") causes segmentation fault error #334

Open yya518 opened 4 years ago

yya518 commented 4 years ago

Please provide a clear and concise description of the problem.

Reproduction Steps

import blocksci
addr = chain.address_from_string('random')

If the address str is 'random' or 'Random', it will cause Segmentation fault (core dumped) error. Anything else seems fine. For example addr = chain.address_from_string('x') says

RuntimeError: Tried to construct invalid address

which is as expected.

System Information

Using AMI: no
BlockSci version: 0.6 Blockchain: Bitcoin
Parser: Disk Total memory: 256 GB

yya518 commented 4 years ago

not sure what the pattern is. but other words like 'Varies' and 'gememe' also cause segmentation fault (core dumped) error. Is it just me?

maltemoeser commented 4 years ago

With certain short string lengths https://github.com/citp/BlockSci/blob/v0.6/src/scripts/bitcoin_base58.cpp#L224 errors due to vchData being empty. Fixing this should be straightforward.