Open ghostiam opened 1 month ago
The crash occurs because the realname
field is NULL
.
I also have another file that also causes a crash, but in a different place, where the realname
field is also to blame.
https://github.com/rizinorg/rizin/blob/e4958fc146cffe60d194b070075d9a53938800e4/librz/core/canalysis.c#L5696
This quick fix helped (but I'm not sure it's correct):
diff --git a/librz/flag/flag.c b/librz/flag/flag.c
index 1baee1dff6..84367de61d 100644
--- a/librz/flag/flag.c
+++ b/librz/flag/flag.c
@@ -680,7 +680,7 @@ RZ_API void rz_flag_item_set_comment(RzFlagItem *item, const char *comment) {
RZ_API void rz_flag_item_set_realname(RzFlagItem *item, const char *realname) {
rz_return_if_fail(item);
free_item_realname(item);
- item->realname = RZ_STR_ISEMPTY(realname) ? NULL : strdup(realname);
+ item->realname = RZ_STR_ISEMPTY(realname) ? item->name : strdup(realname);
}
/* add/replace/remove the color of a flag item */
Environment information
Describe the bug
Crash when trying to display disassembly code.
MacOS report
``` ------------------------------------- Translated Report (Full Report Below) ------------------------------------- Process: cutter [75863] Path: /Applications/Cutter.app/Contents/MacOS/cutter Identifier: re.rizin.cutter Version: 2.3.4-stable-209c26b (2.3.4-stable-209c26b) Code Type: ARM-64 (Native) Parent Process: launchd [1] User ID: 501 Date/Time: 2024-07-24 23:23:32.0016 +0400 OS Version: macOS 14.5 (23F79) Report Version: 12 Anonymous UUID: 5BC71BD9-F14A-2CB9-7C3A-A5EA18D4D253 Sleep/Wake UUID: FF657A00-3D1F-4900-8568-BBFC9479AF65 Time Awake Since Boot: 1800000 seconds Time Since Wake: 114638 seconds System Integrity Protection: enabled Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000 Exception Codes: 0x0000000000000001, 0x0000000000000000 Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11 Terminating Process: exc handler [75863] VM Region Info: 0 is not in any region. Bytes before following region: 4307992576 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL UNUSED SPACE AT START ---> __TEXT 100c6c000-100f84000 [ 3168K] r-x/r-x SM=COW /Applications/Cutter.app/Contents/MacOS/cutter Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_platform.dylib 0x1848393c8 _platform_strstr + 32 1 librz_core.0.7.dylib 0x101fdd6cc ds_print_ptr + 2636 2 librz_core.0.7.dylib 0x101fd8a84 rz_core_print_disasm + 14536 3 cutter 0x100ccf084 0x100c6c000 + 405636 4 cutter 0x100cce59c 0x100c6c000 + 402844 5 cutter 0x100cce1c0 0x100c6c000 + 401856 6 QtCore 0x103d300ec 0x103b28000 + 2130156 7 cutter 0x100c7bab8 CutterSeekable::seekableSeekChanged(unsigned long long, CutterCore::SeekHistoryType) + 72 8 QtCore 0x103d300ec 0x103b28000 + 2130156 9 cutter 0x100c7eaf0 CutterCore::seekChanged(unsigned long long, CutterCore::SeekHistoryType) + 72 10 cutter 0x100c9abd8 CutterCore::seek(unsigned long long) + 140 11 cutter 0x100c99ebc CutterCore::seekAndShow(unsigned long long) + 20 12 QtCore 0x103d300ec 0x103b28000 + 2130156 13 QtWidgets 0x10271d99c QAbstractItemView::activated(QModelIndex const&) + 52 14 QtWidgets 0x10278a16c QTreeView::mouseDoubleClickEvent(QMouseEvent*) + 868 15 QtWidgets 0x10250ea1c QWidget::event(QEvent*) + 128 16 QtWidgets 0x1025a31e0 QFrame::event(QEvent*) + 56 17 QtWidgets 0x10271c450 QAbstractItemView::viewportEvent(QEvent*) + 1124 18 QtWidgets 0x102786cec QTreeView::viewportEvent(QEvent*) + 500 19 QtCore 0x103d0015c QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) + 264 20 QtWidgets 0x1024d8d58 QApplicationPrivate::notify_helper(QObject*, QEvent*) + 260 21 QtWidgets 0x1024db6a4 QApplication::notify(QObject*, QEvent*) + 6072 22 QtCore 0x103cffe44 QCoreApplication::notifyInternal2(QObject*, QEvent*) + 208 23 QtWidgets 0x1024d96dc QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointerTo Reproduce
Steps to reproduce the behavior:
Open file:
blink-crash.elf
from blink.zipTry open function
blink.copy_data
\
Expected behavior
Show disassembly code.
Additional context
If I remove the
copy_data
function, then the crash does not occur(fileblink-no-copy_data.elf
in archive).