Closed JulianGCalderon closed 2 weeks ago
The segmentation fault happens when dereferencing an invalid pointer inside a DictFelt. I've executed it a few times and the pointer dereference has the value 0x1
or 0x8000000000000001
which is an odd value for a pointer.
The fact that the values changes between 0x1
and 0x8000000000000001
is odd, I don't know what causes this.
My guess is that it is stored in the dictionary as a literal and not as a pointer, which is why dereferencing it fails. We should check libfuncs dict_get
and dict_finish
as those are probably related with this.
I've run the same transaction and got this message:
thread 'main' panicked at /home/dev/.cargo/registry/src/index.crates.io-6f17d22bba15001f/smol_str-0.2.2/src/lib.rs:551:31: range end index 240 out of range for slice of length 23
Couldn't find an explanation to it. Running it with the backtrace points out it might be related to serde_json
when trying to parse the trace and failing to do so.
is this fixed?
It is not. It was left unsolved as it was no longer necessary since the main issue was already solved.
Update
The value ptr which is casted before producing the dump differs from the one produced by the FeltDict
constructor. This make the cast be completely wrong:
inner
field (which is a hashmap) has no value in itfree_fn
(used when dropping the felt dict) also differs from its original value.The seg fault happens due to trying the read the entries of this inner field. This means that the value_ptr
gets corrupted during the program execution.
The CONSTRUCTOR PTR is the one created in function cairo_native__dict_new
, also the FREE_FN PTR is from there.
The VALUE PTR and CAST VALUE are printed inside the match of FeltDict
in function read_value_ptr
Solved in this commit
When running transaction 0xde5066db6a374038d33b7c89cce4d3e09e6f645bd5b95ec0986713f51e0c69 with trace-dump feature, execution fails with segmentation fault.
This only happens when using trace dump. stacktrace:
The panic occurs when dumping felt dict entries.