GRegex as PCRE wrapper was introduced in GLib-2.14. PCRE was required
for MC on OSes with GLib < 2.14. Currently MC requires GLib >= 2.32.
Since 2.73.2 (released at 2022-07-08), GRegex is based on PCRE2.
We can remove PCRE and PCRE2 from MC and use GLib only.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Found in Alpine/musl on s390x, confirmed on aarch64 using valgrind - introduced
in 65a7278d8a:
{{{
==156518== Invalid read of size 1
==156518== at 0x413BE0: vfs_parse_ls_lga (parse_ls_vga.c:863)
==156518== by 0x4076C3: process_ls_line (mc_parse_ls_l.c:350)
==156518== by 0x4076C3: process_input (mc_parse_ls_l.c:376)
==156518== by 0x40736B: main (mc_parse_ls_l.c:404)
==156518== Address 0x536be6f is 1 bytes before a block of size 2 alloc'd
==156518== at 0x48854F0: malloc (vg_replace_malloc.c:446)
==156518== by 0x4CF4FCB: g_malloc (gmem.c:100)
==156518== by 0x4D0E99B: g_strdup (gstrfuncs.c:323)
==156518== by 0x413887: g_strdup_inline (gstrfuncs.h:321)
==156518== by 0x413887: vfs_parse_ls_lga (parse_ls_vga.c:848)
==156518== by 0x4076C3: process_ls_line (mc_parse_ls_l.c:350)
==156518== by 0x4076C3: process_input (mc_parse_ls_l.c:376)
==156518== by 0x40736B: main (mc_parse_ls_l.c:404)
}}}
https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/79071
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
if reading directory while terminal's resized.
(dialog_change_screen_size): don't flush SIGWINCH pipe if top_dlg isn't
created yet.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Support Korn shell variants (ksh/oksh/mksh) in the subshell; mksh (MirBSD Korn
shell) is handled separately as it substantially differs from pdksh (Public
Domain Korn shell) based varaints.
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
lib/util.c:493:28: warning: The left operand of '!=' is a garbage value due to array index out of bounds [clang-analyzer-core.UndefinedBinaryOperatorResult]
493 | for (j = units; sfx[j] != NULL; j++)
| ~~~~~~ ^
- verify and limit input 'units' value
Found by Clang-19 Static Analyzer.
Reported-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <vmail.ru>
/tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/quick.c:150:9: warning: Potential leak of memory pointed to by 'label.quick_widget' [clang-analyzer-unix.Malloc]
150 | return;
| ^
Found by Clang-19 Static Analyzer.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Make Static Analyzer happy.
lib/widget/listbox.c:119:51: warning: Division by zero [clang-analyzer-core.DivideZero]
119 | line = 1 + ((l->current * (w->lines - 2)) / length);
Found by Clang-19 Static Analyzer.
Reported-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
quick.c:432:28: runtime error: member access within null pointer of type 'Widget' (aka 'struct Widget')
#0 in quick_dialog_skip lib/widget/quick.c:432:28
#1 in file_mask_dialog src/filemanager/filegui.c:1462:19
#2 in do_confirm_copy_move src/filemanager/file.c:1977:11
#3 in panel_operate src/filemanager/file.c:3536:16
#4 in copy_cmd src/filemanager/./cmd.h:111:5
#5 in midnight_execute_cmd src/filemanager/filemanager.c:1177:9
#6 in midnight_callback src/filemanager/filemanager.c
#7 in send_message lib/widget/../../lib/widget/widget-common.h:255:15
#8 in buttonbar_call lib/widget/buttonbar.c:157:15
#9 in buttonbar_callback lib/widget/buttonbar.c:174:42
#10 in send_message lib/widget/../../lib/widget/widget-common.h:255:15
#11 in group_handle_hotkey lib/widget/group.c:566:23
#12 in group_default_callback lib/widget/group.c:640:16
#13 in dlg_default_callback lib/widget/dialog.c:370:16
#14 in midnight_callback src/filemanager/filemanager.c:1615:16
#15 in send_message lib/widget/../../lib/widget/widget-common.h:255:15
#16 in group_handle_key lib/widget/group.c:503:15
#17 in group_default_callback lib/widget/group.c:637:16
#18 in dlg_key_event lib/widget/dialog.c:252:19
#19 in dlg_process_event lib/widget/dialog.c:539:9
#20 in frontend_dlg_run lib/widget/dialog.c:321:9
#21 in dlg_run lib/widget/dialog.c:573:5
#22 in do_nc src/filemanager/filemanager.c:1826:16
#23 in main src/main.c:469:21
#24 in <null> <null>
#25 in __libc_start_main <null>
#26 in _start <null>
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior quick.c:432:28.
Found by Clang-19 Static Analyzer.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Make Static Analyzer happy.
Bug Group Bug Type File Function/Method Line
Logic error Garbage return value src/filemanager/boxes.c cd_box 1236
Logic error Garbage return value lib/widget/wtools.c fg_input_dialog_help 198
Found by Clang-19 Static Analyzer.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>