-
-
Notifications
You must be signed in to change notification settings - Fork 128
Closed
Description
Applying a binary template containing a string with charset ASCII, while the ASCII view is enabled, crashes REHex with a segmentation fault:
(gdb) bt 4
#0 0x0000616cfd615269 in REHex::DocumentCtrl::DataRegion::get_char_at (this=this@entry=0x616d1b601120, offset=offset@entry=...) at src/DocumentCtrl.cpp:5498
#1 0x0000616cfd61ed64 in REHex::DocumentCtrl::DataRegion::draw (this=0x616d1b601120, doc=..., dc=..., x=0, y=42) at src/DocumentCtrl.cpp:3811
#2 0x0000616cfd61b837 in REHex::DocumentCtrl::OnPaint (this=0x616d1b5c2ee0, event=<optimized out>) at src/DocumentCtrl.cpp:788
#3 0x000077d30f75c43f in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () at /usr/lib/libwx_baseu-3.2.so.0
(More stack frames follow...)
(gdb) p offset
$1 = {value = 0, static INVALID = @0x616cfd861b38, static ZERO = @0x616cfd861b30}
(gdb) l
5493 if(type_at_base->second.name != "")
5494 {
5495 auto type = DataTypeRegistry::get_type(type_at_base->second.name, type_at_base->second.options);
5496 assert(type != NULL);
5497
5498 if(type->encoder != NULL)
5499 {
5500 encoder = type->encoder;
5501 }
5502 }
(gdb) p type
$2 = std::shared_ptr<const REHex::DataType> (empty) = {get() = 0x0}
Minimal example:
$ hexdump -Cv data
00000000 62 65 65 70 20 62 6f 6f 70 20 69 27 6d 20 61 20 |beep boop i'm a |
00000010 74 65 73 74 20 66 69 6c 65 0a |test file.|
0000001a
$ cat test.bt
char blah[16] <charset = "ASCII">;
<charset = "UTF-8"> doesn't crash.