+++ This bug was initially created as a clone of Bug #1007761 +++ Description of problem: $ sgdisk /dev/sda -i 1185 *************************************************************** Found invalid GPT and valid MBR; converting MBR to GPT format in memory. *************************************************************** Segmentation fault (core dumped) The stack trace is: Program received signal SIGSEGV, Segmentation fault. GPTPart::ShowDetails (this=0x851018, blockSize=512) at gptpart.cc:210 210 if (firstLBA != 0) { (gdb) bt #0 GPTPart::ShowDetails (this=0x851018, blockSize=512) at gptpart.cc:210 #1 0x000000000041015e in GPTData::ShowPartDetails ( this=this@entry=0x7fffffffc470, partNum=<optimized out>) at gpt.cc:1406 #2 0x00000000004193d1 in GPTDataCL::DoOptions ( this=this@entry=0x7fffffffc470, argc=argc@entry=4, argv=argv@entry=0x7fffffffde48) at gptcl.cc:255 #3 0x0000000000402dd6 in main (argc=4, argv=0x7fffffffde48) at sgdisk.cc:20
Also fails on Fedora Rawhide. The issue is that partNum is passed direct from the command line (actually partNum == 1185-1 here) and is not bounds-checked at all, so: (gdb) frame 1 #1 0x000000000041015e in GPTData::ShowPartDetails ( this=this@entry=0x7fffffffc470, partNum=<optimized out>) at gpt.cc:1406 1406 partitions[partNum].ShowDetails(blockSize); fails in the array index.
Created attachment 797335 [details] gdisk-0.8.7-add-range-check.patch I pushed this patch to Rawhide. Will send it upstream shortly.
Was not meant to be private.
Thanks for report and patch!
gdisk-0.8.7-2.fc19 has been submitted as an update for Fedora 19. https://admin.fedoraproject.org/updates/gdisk-0.8.7-2.fc19
gdisk-0.8.7-2.fc20 has been submitted as an update for Fedora 20. https://admin.fedoraproject.org/updates/gdisk-0.8.7-2.fc20
gdisk-0.8.7-2.fc18 has been submitted as an update for Fedora 18. https://admin.fedoraproject.org/updates/gdisk-0.8.7-2.fc18
Package gdisk-0.8.7-2.fc20: * should fix your issue, * was pushed to the Fedora 20 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing gdisk-0.8.7-2.fc20' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2013-16778/gdisk-0.8.7-2.fc20 then log in and leave karma (feedback).
gdisk-0.8.7-2.fc20 has been pushed to the Fedora 20 stable repository. If problems still persist, please make note of it in this bug report.
gdisk-0.8.7-2.fc19 has been pushed to the Fedora 19 stable repository. If problems still persist, please make note of it in this bug report.
gdisk-0.8.7-2.fc18 has been pushed to the Fedora 18 stable repository. If problems still persist, please make note of it in this bug report.