Elliott Hughes
2d39d3e54a
Upgrade gptfdisk to cb4bf32074
...
This project was upgraded with external_updater.
Usage: tools/external_updater/updater.sh update gptfdisk
For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md
Test: TreeHugger
Change-Id: Ie0d104dec8963b4a0c698f97843fdbf76d0d6fda
2023-03-15 19:10:32 +00:00
Rod Smith
cb4bf32074
Minor code cleanup based on valgrind analysis
2023-03-10 13:28:00 -05:00
Rod Smith
8ff360f49e
Fix valgrind complaint
2022-04-10 11:09:19 -04:00
Rod Smith
6b7486db99
Abort load of too-small disk image
2022-04-10 10:25:41 -04:00
Rod Smith
fd60f74362
Add end-alignment feature.
2022-01-29 10:51:02 -05:00
Rod Smith
eae9f7e2e1
Code cleanup based on 'infer' suggestions; mostly just dead stores.
...
One forgotten change
2021-03-17 21:59:18 -04:00
Rod Smith
f063fe08e4
Fix spurious warnings of problems on MBR disks
2021-02-01 10:19:50 -05:00
Jeff Sharkey
83fdc99960
Add a fuzzer for gptfdisk.
...
Since gptfdisk is used to parse MBR and GPT partition tables from
untrusted USB and SD card storage devices, we should get a fuzzer
wired up to hunt for security issues.
To enable the fuzzer, we create a new "diskio-heap" implementation
for backing I/O operations, which allows us to treat the fuzzer
input as a fake block device. These changes are as minimal as
possible to avoid future merge conflicts.
The single corpus input is a sample block device with a single
empty GPT partition created using these commands:
$ losetup /dev/loop0 typical.bin
$ gdisk /dev/loop0
And the final table is:
Number Start (sector) End (sector) Size Code Name
1 34 38 2.5 KiB 8300 Linux filesystem
Bug: 170783842
Test: SANITIZE_HOST=address make ${FUZZER_NAME} && ${ANDROID_HOST_OUT}/fuzz/$(get_build_var HOST_ARCH)/${FUZZER_NAME}/${FUZZER_NAME}
Change-Id: I21a2a5f7f1019365accf8fd74c958aaafe7f7ff7
2020-10-13 19:55:52 -06:00
Rod Smith
81c8bbee46
Fix segfault on some weird data structures
2020-09-14 10:08:18 -04:00
Alistair Delva
caedc3271d
ANDROID: Fix heap overflow in sgdisk
...
If a maliciously formatted USB or SD Card device was inserted into an
Android device, the sgdisk tool could crash. This crash occurs because
sgdisk does not validate that the number of GPT partition entries
specified on disk matches the internal maximum permitted by the GPT spec.
Fix this by sanity checking the on disk parameter before using it.
After the fix, sgdisk detects the corrupt GPT during the formatting
procedure, but it is harmlessly zapped and replaced with a new one.
Test: before fix, saw sgdisk crash while the device was booting up
Test: after fix, no more sgdisk crashes
Test: went through "portable storage" and "adopted storage" wizard flows
using the cuttlefish virtual device and a malicious partition
table flashed to the device
Bug: 152874864
Change-Id: Iec64bc2ef5c31ad985126f9cf3b755eec7de3abe
2020-05-20 13:26:51 -07:00
Haibo Huang
c83113b1d8
Upgrade gptfdisk to d292ff36a3
...
Change 2c2deeb032 is reverted in this
merge. Because it conflicts with upstream option "move-main-table".
Change-Id: I2c1cb67a95139879333a430eb0e8b34f6b396c32
2020-02-10 11:24:48 -08:00
Rod Smith
9ae60195b9
Added explicit copy constructors and made other tweaks to avoid
...
compiler complaints.
2018-07-05 16:50:13 -04:00
Rod Smith
44cda477df
Added search/filter feature to "L" function to display partition type
...
codes.
2018-07-05 09:07:58 -04:00
Weiping Zhang
826f8a0d53
Show detail status of header and table
...
Signed-off-by: Weiping Zhang <zhangweiping@didichuxing.com >
2018-06-22 01:19:13 +08:00
Weiping Zhang
c41db9e690
load main partition table if main header crc is ok
...
mainCrcOk and secondCrcOk were overwritten by header rebuilding.
Signed-off-by: Weiping Zhang <zhangweiping@didichuxing.com >
2018-06-22 01:19:13 +08:00
Rod Smith
5e490b279f
Changed "Creating new GPT entries" message to "Creating new GPT
...
entries in memory" because the latter is clearer and more precise.
2018-04-29 16:23:49 -04:00
Rod Smith
f1f6236fb4
Fixed a major bug that caused improper partition tables to be created.
...
Version 1.0.3 release.
2017-07-27 21:59:14 -04:00
Rod Smith
7dfc896734
Added support for showing the disk's model name under Linux.
2017-07-26 19:45:51 -04:00
Rod Smith
fc0e014bea
Added code to read physical block size on Linux.
2017-07-25 21:33:18 -04:00
Rod Smith
0dfa506ba6
Added a couple of new verification checks and minor tweaks.
2017-07-23 11:50:17 -04:00
Rod Smith
503e9ada12
Initial commit of support for moving main partition table to arbitrary
...
location on disk (within limits based on existing partitions).
2017-07-21 21:48:13 -04:00
Aurimas Liutikas
6d5a8afcca
Revert "Update external/gptfdisk to 1.0.1" am: bdbab02f71 am: 165c596ac3
...
am: fa990d2e3b
Change-Id: I88a6501b6dbc6b6682ac414a1aa590a11bbd3306
2017-03-07 21:46:12 +00:00
Aurimas Liutikas
bdbab02f71
Revert "Update external/gptfdisk to 1.0.1"
...
This reverts commit 74b7490a22 .
This change caused a regression in fugu usb formatting.
Bug: 35217931
Test: None
Change-Id: I50c73bde912a7c941e1d67d41bfab02042db88eb
2017-03-07 09:51:00 -08:00
Aurimas Liutikas
38e853e544
Merge "Fix all warnings and enable -Werror for gptfdisk." am: 2c054ab90e am: 7424963b5b am: 8ca4df28c5
...
am: 2fd2c48cd3
Change-Id: I1060e62981950fa582e880d6aba6ca9e246587c3
2016-10-27 23:52:52 +00:00
Greg Hartman
2c2deeb032
Add an option to allow disk syncing to be turned off
...
Bug: 27795746
Change-Id: I47447a8467c409db526483ac7e4a9394cd68578a
(cherry picked from commit fd9b918d2e49de4b7b7568aaa39f7e179752766d)
2016-07-14 20:45:39 +00:00
Aurimas Liutikas
fcad060a1d
Fix all warnings and enable -Werror for gptfdisk.
...
Bug: 26936282
Change-Id: Id7e9ec5e769e1abedc1d2e36bff2c5488b1c4b3e
2016-05-10 19:16:10 -07:00
Aurimas Liutikas
74b7490a22
Update external/gptfdisk to 1.0.1
...
Updates gpftdisk to the latest version 0.8.10 (ish) -> 1.0.1
The downstream patches should be uneffected.
Change-Id: I527678c0b24194f3947e360f0f38c45cfa3b0d1c
2016-05-10 18:53:54 -07:00
Roderick W. Smith
846a9e30cd
Version 1.0.1 release.
2015-10-18 19:21:11 -04:00
Jeff Sharkey
d761ff5a2a
Revert "Offer to print partition info in raw format."
...
This reverts commit 729f7bd5fe .
2015-02-28 19:18:39 -08:00
Jeff Sharkey
729f7bd5fe
Offer to print partition info in raw format.
...
This raw format is easier for other scripts to parse.
Change-Id: I15b3011376e27c28fd40b9c3b2722a75bb8cde25
2015-02-23 16:41:48 -08:00
Roderick W. Smith
1f7822eb54
Changes to support compilation with UEFI GPT fdisk library.
2014-03-28 23:54:21 -04:00
Roderick W. Smith
84aaff6b9c
Removed libicu dependency for UTF-16 partition names. Version 0.8.9
...
release.
2014-02-17 16:17:11 -05:00
Roderick W. Smith
5435fcf5c4
Checks on backup GPT data structures added to GPTData::DestroyGPT().
2014-02-17 12:01:51 -05:00
Roderick W. Smith
4a702a2e26
New checks for an oversized 0xEE protective (or any hybrid MBR)
...
partition. Auto-corrects on loading if protective & otherwise valid;
if not, verify and save operations warn of the problem.
2014-01-25 23:46:42 -05:00
Roderick W. Smith
24bba6e4f3
Fixed bug in sgdisk that could cause segfault when passing an invalid
...
partition number to -i/--info; added patch to fix compiling problems
with some versions of GCC.
2013-10-12 19:07:16 -04:00
Roderick W. Smith
e3ee733ff8
Removed 0x8302 type code, since the Red Hat parted developers have
...
decided against using it.
2013-09-24 12:56:11 -04:00
Roderick W. Smith
042f38a2f7
Check for boot/active flag on 0xEE protective partition in verify
...
function.
2013-08-31 17:40:15 -04:00
Roderick W. Smith
1eea9b0b51
New partition type codes & "-a" option for cgdisk
2013-07-06 22:52:58 -04:00
srs5694
f5dfbfa418
Change to alignment code in sgdisk.
2013-02-14 20:47:14 -05:00
srs5694
0741fa21ac
0.8.6 release.
2013-01-09 12:55:40 -05:00
srs5694
d8eed46294
Added partition type codes; new verification check.
2012-12-15 01:55:21 -05:00
srs5694
4307ef2e86
Version 0.8.5 release
2012-05-30 12:30:48 -04:00
srs5694
3488294d71
GPT fdisk 0.8.3 release; minor bug fixes & feature changes.
2012-03-23 12:49:15 -04:00
srs5694
706e51217a
Changes to partition table size management for Solaris-created GPTs
2012-01-21 13:47:24 -05:00
srs5694
e69e6807cf
Fixes related to handling of GPTs created under Solaris
2012-01-20 22:37:12 -05:00
srs5694
0541b56fee
Minor bug fixes
2011-12-18 16:35:25 -05:00
srs5694
23d8d54cdf
Changes for GPT fdisk version 0.8.1
2011-10-01 18:40:10 -04:00
srs5694
d1b11e8305
Fixed bug in reading GPTs with encoded header sizes other than 92 bytes.
2011-09-18 21:12:28 -04:00
srs5694
a17fe69ec0
Changes for version 0.8.0
2011-09-10 20:30:20 -04:00
srs5694
00b6d7a460
0.7.2 release, includes new Linux type code & true GUID generation in
...
Windows
2011-06-26 22:40:06 -04:00