diff options
author | Andrey Ulanov <andreyu@google.com> | 2015-06-10 20:02:06 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-06-13 02:53:36 +0000 |
commit | 1eb83efdba367db2a590eb94a0cc45cd538aa696 (patch) | |
tree | 72efa521b7d5357346c7054c65243454e6234c1e /firmware/include | |
parent | 637ff03502f3511d90e8d79cc1c52b3be01d6cd3 (diff) | |
download | vboot-stabilize-7199.B.tar.gz |
cgpt repair: fix segfault which occurs when one of the headers is badstabilize-7202.Bstabilize-7199.Bstabilize-7173.B
When one of GPT headers is invalid the corresponding partition table
is not loaded and corresponding pointers in GptData are NULL.
GptRepair will try to memcpy one entries table to another which
results in SIGSEGV.
This change fixes it by freeing and then reallocating bad copy of
partition table. This potentially fixes problems which would occur
if two tables have different size.
Change that initially introduced this problem by not always allocating
secondary_entries:
https://chromium-review.googlesource.com/223800
TEST="cgpt repair" works where it previously didn't
TEST=make runtests
BUG=brillo:1203
BRANCH=none
Change-Id: Ibb2fcf33faa5ba157b0865d04c90ee3f26eee113
Reviewed-on: https://chromium-review.googlesource.com/276766
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Andrey Ulanov <andreyu@google.com>
Tested-by: Andrey Ulanov <andreyu@google.com>
Diffstat (limited to 'firmware/include')
-rw-r--r-- | firmware/include/gpt_misc.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/firmware/include/gpt_misc.h b/firmware/include/gpt_misc.h index a94224f3..e5a366bb 100644 --- a/firmware/include/gpt_misc.h +++ b/firmware/include/gpt_misc.h @@ -84,9 +84,9 @@ typedef struct { uint8_t *primary_header; /* GPT secondary header, from last sector of disk (size: 512 bytes) */ uint8_t *secondary_header; - /* Primary GPT table, follows primary header (size: 16 KB) */ + /* Primary GPT table, follows primary header */ uint8_t *primary_entries; - /* Secondary GPT table, precedes secondary header (size: 16 KB) */ + /* Secondary GPT table, precedes secondary header */ uint8_t *secondary_entries; /* Size of a LBA sector, in bytes */ uint32_t sector_bytes; |