From: Shlomi Fish <shlomif@shlomifish.org> Date: Wed, 29 Apr 2020 20:52:51 +0000 (+0300) Subject: add a regression test for an overflow X-Git-Tag: fortune-mod-2.24.0~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4b6217ce4d23c54d971ec0bbbbb69ed7c5ab7809;p=fortune-mod add a regression test for an overflow --- diff --git a/fortune-mod/tests/t/valgrind.t b/fortune-mod/tests/t/valgrind.t index 97123fb..b0944f5 100644 --- a/fortune-mod/tests/t/valgrind.t +++ b/fortune-mod/tests/t/valgrind.t @@ -10,7 +10,7 @@ if ( $^O eq "MSWin32" ) { plan skip_all => 'valgrind is not available on Windows'; } -plan tests => 6; +plan tests => 7; my $obj = Test::RunValgrind->new( {} ); @@ -54,22 +54,18 @@ $obj->run( } ); -# TEST -$obj->run( - { - log_fn => './fortune--strfile-buffer-overflow.valgrind-log', - prog => './strfile', - argv => [ scalar( "AAAAAAAAAAAAAAAA/" x 1000 ) ], - blurb => 'strfile overflow test', - } -); - -# TEST -$obj->run( - { - log_fn => './fortune--unstr-buffer-overflow.valgrind-log', - prog => './unstr', - argv => [ scalar( "AAAAAAAAAAAAAAAA/" x 1000 ) ], - blurb => 'unstr overflow test', - } -); +# TEST*3 +foreach my $prog (qw/ strfile unstr randstr /) +{ + $obj->run( + { + log_fn => "./fortune--$prog-buffer-overflow.valgrind-log", + prog => "./$prog", + argv => [ + ( ( $prog eq "randstr" ) ? ("filler") : () ), + scalar( "AAAAAAAAAAAAAAAA/" x 1000 ) + ], + blurb => "$prog buffer overflow test", + } + ); +}