]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: od: test command line arguments are checked for overflow master
authorCollin Funk <collin.funk1@gmail.com>
Sat, 13 Jun 2026 22:30:42 +0000 (15:30 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Sat, 13 Jun 2026 22:30:42 +0000 (15:30 -0700)
* tests/od/od.pl ($INTMAX_OFLOW): Add definition.
(@Tests): Test -j, -N, -S, and -w with $INTMAX_OFLOW.

tests/od/od.pl

index 1e515c0269fafda59036dbe6eb70b03429fe0bfa..b1dd46b034243585124a9d3cc4df73ac1765d977 100755 (executable)
@@ -19,6 +19,7 @@
 use strict;
 
 my $limits = getlimits ();
 use strict;
 
 my $limits = getlimits ();
+my $INTMAX_OFLOW = $limits->{INTMAX_OFLOW};
 
 (my $program_name = $0) =~ s|.*/||;
 
 
 (my $program_name = $0) =~ s|.*/||;
 
@@ -101,6 +102,11 @@ my @Tests =
       {ERR=>"$prog: invalid -w argument 'w'\n"}],
     );
 
       {ERR=>"$prog: invalid -w argument 'w'\n"}],
     );
 
+push @Tests,
+  map {["$_-overflow", "-$_$INTMAX_OFLOW",
+        {IN_PIPE=>""}, {EXIT=>1},
+        {ERR=>"od: -$_ argument '$INTMAX_OFLOW' too large\n"}]} qw(j N S w);
+
 my $save_temps = $ENV{DEBUG};
 my $verbose = $ENV{VERBOSE};
 
 my $save_temps = $ENV{DEBUG};
 my $verbose = $ENV{VERBOSE};