On 18/03/14 13:55, Frederico Rodrigues Abraham wrote:
Here is the stack trace:

Program received signal SIGSEGV, Segmentation fault.
key::read_key (buffer=buffer@entry=0xffffffffffffffff <Address 0xffffffffffffffff out of bounds>) at crypt_key.cpp:44
44          if( buff->version!=htonl(VERSION_MAGIC_1) )
(gdb)
(gdb) bt
#0  key::read_key (buffer=buffer@entry=0xffffffffffffffff <Address 0xffffffffffffffff out of bounds>) at crypt_key.cpp:44
#1  0x00000000004047f0 in read_header (headfd=...) at crypto.cpp:102
#2  0x0000000000408a3a in file_decrypt (src_file=0x9357158 "filesencrypted/files/40AEBACBA5170D57464965CA52861A2F",
    dst_file=0x9357238 "../ugah/files/work/tecgraf/lib/visnew/include/old/sg/strat/render/slrender.h", key_file=0x93572d8 "filesencrypted/keys/files/40AEBACBA5170D57464965CA52861A2F",
    rsa_key=rsa_key@entry=0x6296a0, stat=stat@entry=0x7fffffffb660) at file.cpp:445
This makes zero sense.

The segmentation fault is due to trying to dereference a pointer pointing to 0xffffffffffffffff (-1), which is what mmap returns when it fails. This, like I said, makes no sense, as in such a case it should have thrown an exception (hmmm...., upon looking at the code again, maybe not...).

Can you please run the code with strace and send me (in private) the result? I can see why the error wouldn't be detected on 64 bit, but I still don't understand why mmap would fail to begin with.

Thanks,
Shachar