Bug 500818

Summary: sigsegv when moving cursor in binary file
Product: [Fedora] Fedora Reporter: Michal Hlavinka <mhlavink>
Component: mcAssignee: Jindrich Novy <jnovy>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 10CC: dvlasenk, jnovy, pknirsch
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 4.6.2-8.fc10 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-05-30 02:28:59 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Michal Hlavinka 2009-05-14 11:33:34 UTC
Description of problem:
when moving cursor in binary file, mc crashes

Version-Release number of selected component (if applicable):
mc-4.6.2-7.pre1.fc10.x86_64

How reproducible:
always

Steps to Reproduce:
1.open some binary file for editing
2.use ctrl+right arrow
3.
  
Actual results:
sigsegv

Expected results:
no sigsegv

Additional info:

Comment 1 Michal Hlavinka 2009-05-14 11:34:22 UTC
(gdb) bt
#0  strchr () at ../sysdeps/x86_64/strchr.S:101
#1  0x000000000044fedf in my_type_of (c=1048064) at edit.c:1820
#2  0x0000000000452df7 in edit_right_word_move () at edit.c:1868
#3  edit_right_word_move_cmd () at edit.c:1888
#4  edit_execute_cmd (edit=0x2819e20, command=<value optimized out>, char_for_insertion=<value optimized out>) at edit.c:2485
#5  0x000000000045441a in edit_execute_key_command (edit=0x2819e20, command=9, char_for_insertion=4294967295) at edit.c:2292
#6  0x000000000045b798 in edit_callback (w=0x2819e20, msg=<value optimized out>, parm=<value optimized out>) at editwidget.c:349
#7  0x0000000000412af4 in dlg_key_event () at dialog.c:659
#8  dlg_process_event (h=0x2800530, key=16789, event=<value optimized out>) at dialog.c:753
#9  0x0000000000412e76 in frontend_run_dlg () at dialog.c:785
#10 run_dlg (h=0x2800530) at dialog.c:800
#11 0x000000000045b45e in edit_file (_file=<value optimized out>, line=0) at editwidget.c:212
#12 0x000000000040e315 in do_edit_at_line (what=0x2809370 "dovecot.index.cache", start_line=1048064) at cmd.c:270
#13 0x0000000000448b68 in buttonbar_call (bb=0x7fff9863c000, i=0) at widget.c:2552
#14 0x0000000000449435 in buttonbar_callback (w=0x2803a80, msg=<value optimized out>, parm=1004) at widget.c:2574
#15 0x0000000000412bbf in dlg_try_hotkey () at dialog.c:614
#16 dlg_key_event () at dialog.c:652
#17 dlg_process_event (h=0x27ed5e0, key=1004, event=<value optimized out>) at dialog.c:753
#18 0x0000000000412e76 in frontend_run_dlg () at dialog.c:785
#19 run_dlg (h=0x27ed5e0) at dialog.c:800
#20 0x00000000004293c4 in setup_panels_and_run_mc () at main.c:1740
#21 do_nc () at main.c:1812
#22 main (argc=<value optimized out>, argv=<value optimized out>) at main.c:2319

Comment 2 Michal Hlavinka 2009-05-14 11:37:44 UTC
problem is in edit.c : static unsigned long my_type_of (int c)

see backtrace:
#1 - it gets 'c' = 1048064
this pass:  if (!c) return 0;
but produces sigsegv here: while ((q = strchr (q + 1, c)));

reason:
strch won't terminate at the end of array as q is array of chars and (char)c == 0 == 1048064 % 256

Comment 3 Jindrich Novy 2009-05-15 13:16:27 UTC
Fixed in rawhide, thanks for reporting :)

Comment 4 Michal Hlavinka 2009-05-18 06:44:25 UTC
I've tested it and it works fine, thanks

Comment 5 Fedora Update System 2009-05-28 09:15:29 UTC
mc-4.6.2-10.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/mc-4.6.2-10.fc11

Comment 6 Fedora Update System 2009-05-30 02:28:49 UTC
mc-4.6.2-10.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 7 Fedora Update System 2009-06-01 09:21:36 UTC
mc-4.6.2-8.fc10 has been submitted as an update for Fedora 10.
http://admin.fedoraproject.org/updates/mc-4.6.2-8.fc10

Comment 8 Fedora Update System 2009-06-01 10:55:47 UTC
mc-4.6.2-4.fc9 has been submitted as an update for Fedora 9.
http://admin.fedoraproject.org/updates/mc-4.6.2-4.fc9

Comment 9 Fedora Update System 2009-06-02 14:15:47 UTC
mc-4.6.2-4.fc9 has been pushed to the Fedora 9 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2009-06-02 14:34:56 UTC
mc-4.6.2-8.fc10 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.