Revert incorrect off-by-one fix when embedding in MBR (LP: #1051154).

This commit is contained in:
Colin Watson 2012-09-19 02:48:29 +01:00
parent a8fd349517
commit 6c18452532
4 changed files with 34 additions and 2 deletions

1
debian/changelog vendored
View File

@ -3,6 +3,7 @@ grub2 (2.00-5) UNRELEASED; urgency=low
* Backport from upstream: * Backport from upstream:
- Remove extra layer of escaping from grub_probe. - Remove extra layer of escaping from grub_probe.
- Add efifwsetup module to reboot into firmware setup menu. - Add efifwsetup module to reboot into firmware setup menu.
- Revert incorrect off-by-one fix when embedding in MBR (LP: #1051154).
* Switch watch file to point to ftp.gnu.org. * Switch watch file to point to ftp.gnu.org.
* Build-depend on liblzma-dev, enabling 'grub-mkimage -C xz'. * Build-depend on liblzma-dev, enabling 'grub-mkimage -C xz'.
* Adjust /etc/grub.d/30_os-prober to detect Ubuntu's use of "recovery" * Adjust /etc/grub.d/30_os-prober to detect Ubuntu's use of "recovery"

View File

@ -0,0 +1,30 @@
Description: Revert incorrect off-by-one fix when embedding in MBR
A 62-sector core image should fit before end == 63.
Author: Colin Watson <cjwatson@ubuntu.com>
Origin: upstream, http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/4586
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1051154
Forwarded: not-needed
Applied-Upstream: http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/4586
Last-Update: 2012-09-19
Index: b/grub-core/partmap/msdos.c
===================================================================
--- a/grub-core/partmap/msdos.c
+++ b/grub-core/partmap/msdos.c
@@ -316,14 +316,14 @@
break;
}
- if (end >= *nsectors + 2)
+ if (end >= *nsectors + 1)
{
unsigned i, j;
char *embed_signature_check;
unsigned int orig_nsectors, avail_nsectors;
orig_nsectors = *nsectors;
- *nsectors = end - 2;
+ *nsectors = end - 1;
avail_nsectors = *nsectors;
if (*nsectors > max_nsectors)
*nsectors = max_nsectors;

View File

@ -21,3 +21,4 @@ install_efi_fallback.patch
mkconfig_overescaping.patch mkconfig_overescaping.patch
efifwsetup.patch efifwsetup.patch
mkconfig_ubuntu_recovery.patch mkconfig_ubuntu_recovery.patch
msdos_embed_off_by_one.patch

View File

@ -316,14 +316,14 @@ pc_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors,
break; break;
} }
if (end >= *nsectors + 2) if (end >= *nsectors + 1)
{ {
unsigned i, j; unsigned i, j;
char *embed_signature_check; char *embed_signature_check;
unsigned int orig_nsectors, avail_nsectors; unsigned int orig_nsectors, avail_nsectors;
orig_nsectors = *nsectors; orig_nsectors = *nsectors;
*nsectors = end - 2; *nsectors = end - 1;
avail_nsectors = *nsectors; avail_nsectors = *nsectors;
if (*nsectors > max_nsectors) if (*nsectors > max_nsectors)
*nsectors = max_nsectors; *nsectors = max_nsectors;