Hi,

When using disk images we get a reproduceable crash as shown below:


% gdb parted/parted
GNU gdb (GDB) 16.3
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from parted/parted...
(gdb) r openwrt-24.10.2.img
Starting program: /usr/src/sources/parted-3.6/parted/parted openwrt-24.10.2.img
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
WARNING: You are not superuser.  Watch out for permissions.
GNU Parted 3.6
Using /usr/src/sources/parted-3.6/openwrt-24.10.2.img
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) q

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7d4293d in __freelocale (dataset=0x0) at freelocale.c:43
43        if (cnt != LC_ALL && dataset->__locales[cnt]->usage_count != UNDELETABLE)
(gdb) where
#0  0x00007ffff7d4293d in __freelocale (dataset=0x0) at freelocale.c:43
#1  __freelocale (dataset=0x0) at freelocale.c:31
#2  0x00000000004322c0 in ped_disk_atari_done () at atari.c:1974
#3  0x0000000000423ba8 in done_disk_types () at libparted.c:169
#4  0x0000000000423c35 in _done () at libparted.c:229
#5  0x00007ffff7fc8fc2 in _dl_call_fini (closure_map=closure_map@entry=0x7ffff7ffe2f0) at dl-call_fini.c:43
#6  0x00007ffff7fcccd2 in _dl_fini () at dl-fini.c:120
#7  0x00007ffff7d4edf1 in __run_exit_handlers (status=0, listp=0x7ffff7eeb840 <__exit_funcs>,     run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:118
#8  0x00007ffff7d4eeba in __GI_exit (status=<optimized out>) at exit.c:148
#9  0x000000000041bb71 in do_quit (dev=0x7fffffffe910, diskp=0x7fffffffe908) at parted.c:1646 #10 0x0000000000418654 in command_run (cmd=0x4c4980, dev=0x7fffffffe910, diskp=0x7fffffffe908) at command.c:142 #11 0x00000000004217c4 in interactive_mode (dev=0x7fffffffe910, disk=0x7fffffffe908, cmd_list=0x4bb980 <commands>)
    at ui.c:1646
#12 0x000000000041dfb1 in main (argc=0, argv=0x7fffffffea48) at parted.c:2694
(gdb) quit
A debugging session is active.

    Inferior 1 [process 273459] will be killed.

Quit anyway? (y or n) y


Fix seems to be to just warp freelocale() in atari.c with an approprate NULL test


diff -cr ./libparted/labels/atari.c.orig ./libparted/labels/atari.c
*** ./libparted/labels/atari.c.orig    2025-09-24 17:23:24.076680583 +0400
--- ./libparted/labels/atari.c    2025-09-24 15:56:02.868194331 +0400
***************
*** 1971,1975 ****
  ped_disk_atari_done ()
  {
      ped_disk_type_unregister (&atari_disk_type);
!         freelocale(atr_c_locale);
  }
--- 1971,1977 ----
  ped_disk_atari_done ()
  {
      ped_disk_type_unregister (&atari_disk_type);
!         if (atr_c_locale != NULL) {
!                         freelocale(atr_c_locale);
!         }
  }




Reply via email to