]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
od: fix integer overflow with large pseudos
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 29 Jun 2025 00:36:04 +0000 (17:36 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 29 Jun 2025 04:00:41 +0000 (21:00 -0700)
* src/od.c (format_address_label): Diagnose overflow.

src/od.c

index b3af4c72f73fe90dc5425d9e9a4ed6827c401cd5..c3c76cc86618b4c8d77fa5133ee51006918bbd8a 100644 (file)
--- a/src/od.c
+++ b/src/od.c
@@ -1227,7 +1227,12 @@ static void
 format_address_label (intmax_t address, char c)
 {
   format_address_std (address, ' ');
-  format_address_paren (address + pseudo_offset, c);
+
+  intmax_t addr;
+  if (ckd_add (&addr, address, pseudo_offset))
+    error (EXIT_FAILURE, 0, _("pseudo address too large for input"));
+
+  format_address_paren (addr, c);
 }
 
 /* Write N_BYTES bytes from CURR_BLOCK to standard output once for each