From: Jan Beulich Date: Fri, 4 Apr 2025 08:25:31 +0000 (+0200) Subject: objcopy: also check --file-alignment option argument X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4fa9476ad23d5868c2bc4c02dc1a73acaefbcbc2;p=thirdparty%2Fbinutils-gdb.git objcopy: also check --file-alignment option argument ... to be a power of two, just like --section-alignment does. --- diff --git a/binutils/objcopy.c b/binutils/objcopy.c index 5048648de0f..31933e13b7a 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -5943,6 +5943,11 @@ copy_main (int argc, char *argv[]) case OPTION_FILE_ALIGNMENT: pe_file_alignment = parse_vma (optarg, "--file-alignment"); + if (power_of_two (pe_file_alignment) == -1) + { + non_fatal (_("--file-alignment argument is not a power of two: %s - ignoring"), optarg); + pe_file_alignment = (bfd_vma) -1; + } break; case OPTION_HEAP: