Bug 1007761 - Segmentation fault when argument 'partnum' of part-get-gpt-type is too large
Segmentation fault when argument 'partnum' of part-get-gpt-type is too large
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: gdisk (Show other bugs)
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Tomáš Bžatek
Desktop QE
Depends On: 1007847
  Show dependency treegraph
Reported: 2013-09-13 05:32 EDT by bfan
Modified: 2015-03-03 18:06 EST (History)
5 users (show)

See Also:
Fixed In Version: gdisk-0.8.6-2.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1007847 (view as bug list)
Last Closed: 2014-06-13 06:02:38 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description bfan 2013-09-13 05:32:00 EDT
Description of problem:
when partnum >= 1185, part-get-gpt-type will give an error.

libguestfs: error: part_get_gpt_type: sgdisk /dev/sda -i 1185: *** Segmentation fault
Register dump:

 RAX: 0000000000000000   RBX: 00000000019e6018   RCX: 0000000035383131
 RDX: 0000000000353831   RSI: 0000000000000200   RDI: 00000000019e6018
 RBP: 0000000000000000   R8 : 0000000000000000   R9 : 0000000000000002

but guestfish is still alive. It looks like a bug of sgdisk

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
# guestfish -N fs part-disk /dev/sda gpt : part-get-gpt-type /dev/sda 1185

Actual result:
Gives a "Segmentation fault" error

Expect result:
Not return "Segmentation fault"

Additional info:
I tried "sgdisk /dev/sda -i 1185" in linux, it failed
# sgdisk /dev/sda -i 1185

Found invalid GPT and valid MBR; converting MBR to GPT format.

Segmentation fault (core dumped)
Comment 1 Richard W.M. Jones 2013-09-13 08:58:06 EDT
You were right that this is a bug in gdisk.  Easily
reproducible on the command line:

$ 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
Comment 2 Tomáš Bžatek 2013-09-26 08:28:19 EDT
Backported changes from bug 1007847 and built gdisk-0.8.6-2.el7
Comment 5 Ludek Smid 2014-06-13 06:02:38 EDT
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.

Note You need to log in before you can comment on or make changes to this bug.