--- gptfdisk-0.8.7.old/gpt.cc	2013-07-09 03:01:09.000000000 +0100
+++ gptfdisk-0.8.7/gpt.cc	2013-09-13 14:12:19.154495469 +0100
@@ -1402,6 +1402,10 @@
 
 // Show detailed information on the specified partition
 void GPTData::ShowPartDetails(uint32_t partNum) {
+   if (partNum >= numParts) {
+     cerr << "Partition number out of range\n";
+     exit (1);
+   }
    if (!IsFreePartNum(partNum)) {
       partitions[partNum].ShowDetails(blockSize);
    } else {
