Skip to content

Commit aea8ff9

Browse files
maukethibaultduponchelle
authored andcommitted
XS::APItest: test newSVpvf with blank format string
1 parent fe1c169 commit aea8ff9

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

MANIFEST

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5156,6 +5156,7 @@ ext/XS-APItest/t/my_strtod.t XS::APItest: test my_strtod
51565156
ext/XS-APItest/t/newAV.t XS::APItest: test newAV* functions
51575157
ext/XS-APItest/t/newCONSTSUB.t XS::APItest: test newCONSTSUB(_flags)
51585158
ext/XS-APItest/t/newDEFSVOP.t XS::APItest: test newDEFSVOP
5159+
ext/XS-APItest/t/newSVpvf.t XS::APItest: test newSVpvf
51595160
ext/XS-APItest/t/Null.pm Helper for ./blockhooks.t
51605161
ext/XS-APItest/t/op.t XS::APItest: tests for OP related APIs
51615162
ext/XS-APItest/t/op_contextualize.t test op_contextualize() API

ext/XS-APItest/APItest.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use strict;
44
use warnings;
55
use Carp;
66

7-
our $VERSION = '1.42';
7+
our $VERSION = '1.43';
88

99
require XSLoader;
1010

ext/XS-APItest/APItest.xs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5032,6 +5032,15 @@ sv_regex_global_pos_set(SV *sv, STRLEN pos, U32 flags = 0)
50325032
void
50335033
sv_regex_global_pos_clear(SV *sv)
50345034

5035+
SV *
5036+
newSVpvf_blank()
5037+
CODE:
5038+
GCC_DIAG_IGNORE_STMT(-Wformat-zero-length);
5039+
RETVAL = newSVpvf("");
5040+
GCC_DIAG_RESTORE_STMT;
5041+
OUTPUT:
5042+
RETVAL
5043+
50355044
MODULE = XS::APItest PACKAGE = XS::APItest::AUTOLOADtest
50365045

50375046
int

ext/XS-APItest/t/newSVpvf.t

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!perl
2+
use strict;
3+
use warnings;
4+
5+
use Test::More;
6+
7+
use XS::APItest qw(newSVpvf_blank);
8+
9+
# gh #23393 - empty format string crashes newSVpvf
10+
is newSVpvf_blank, "", 'newSVpvf("") returns "" without crashing';
11+
12+
done_testing;

0 commit comments

Comments
 (0)