This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Since NUM_ANYOF_CODE_POINTS is 256, this_end is always < 256.
authorJarkko Hietaniemi <jhi@iki.fi>
Wed, 26 Aug 2015 02:45:57 +0000 (22:45 -0400)
committerJarkko Hietaniemi <jhi@iki.fi>
Fri, 9 Oct 2015 11:05:34 +0000 (07:05 -0400)
(And the %04X will not happen.)

(regcomp.h says that in theory NUM_ANYOF_CODE_POINTS can be more than 256.)

Coverity CID 104774

regcomp.c

index f6dd9f0..88118b3 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -18116,9 +18116,13 @@ S_put_range(pTHX_ SV *sv, UV start, const UV end, const bool allow_literals)
         this_end = (end < NUM_ANYOF_CODE_POINTS)
                     ? end
                     : NUM_ANYOF_CODE_POINTS - 1;
+#if NUM_ANYOF_CODE_POINTS > 256
         format = (this_end < 256)
                  ? "\\x{%02"UVXf"}-\\x{%02"UVXf"}"
                  : "\\x{%04"UVXf"}-\\x{%04"UVXf"}";
+#else
+        format = "\\x{%02"UVXf"}-\\x{%02"UVXf"}";
+#endif
         GCC_DIAG_IGNORE(-Wformat-nonliteral);
         Perl_sv_catpvf(aTHX_ sv, format, start, this_end);
         GCC_DIAG_RESTORE;