Skip to content

segfault on OS X near the end of the data #6

@GoogleCodeExporter

Description

@GoogleCodeExporter
What steps will reproduce the problem?
1. Build on OSX
2. run

What is the expected output? What do you see instead?
Expect everything to be parsed.

See segfault.

... much trimmed
Successfully opened block-chain input file '/Users/bruce/Library/Application 
Support/Bitcoin/blocks/blk00104.dat'
Scanned 277,415 block headers so far, 819 since last time.
Successfully opened block-chain input file '/Users/bruce/Library/Application 
Support/Bitcoin/blocks/blk00105.dat'
Scanned 278,284 block headers so far, 869 since last time.
Warning: Missing block-header; scanning for next one.
Process 32116 stopped
* thread #1: tid = 0x4b6280, 0x000000010000dc04 
blockchain.out`BlockChainImpl::readBlockHeader(this=0x0000000101000000) + 310 
at BlockChain.cpp:4353, queue = 'com.apple.main-thread, stop reason = 
EXC_BAD_ACCESS (code=1, address=0x10ba00000)
    frame #0: 0x000000010000dc04 blockchain.out`BlockChainImpl::readBlockHeader(this=0x0000000101000000) + 310 at BlockChain.cpp:4353
   4350                     for (uint32_t i=0; i<c; i++)
   4351                     {
   4352                         const uint32_t *check = (const uint32_t *)&temp[i];
-> 4353                         if ( *check == MAGIC_ID )
   4354                         {
   4355                             printf("Found the next block header after skipping: %s bytes forward in the file.\r\n", formatNumber(i) );
   4356                             lastBlockRead+=i; // advance to this location.

i = 10485757
temp = 0x000000010a000000
check = 0x000000010a9ffffd

The bad access is to 0x10ba00000, three bytes past check
((char*)check)[0] = 0
((char*)check)[1] = 0
((char*)check)[2] = 0
((char*)check)[3] = segfault


What version of the product are you using? On what operating system?

svn revision 55 running on OS X Mavericks


Please provide any additional information below.

I already fixed the file path separator.
The program takes less than a second to get to the point of the crash!

Original issue reported on code.google.com by bruce.ho...@gmail.com on 5 Jan 2014 at 11:13

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions