Subject: libphonenumber FTBFS with gcc-15 and -Wbidi-char
Package: libphonenumber8
Source: libphonenumber
X-Debbugs-Cc: [email protected]
Version: 8.13.51+ds-4.2
Severity: normal
attempting to compile libphonenumber with Ubuntu defaults with gcc-15
results in a FTBFS. This is due to -Werror=bidi-char being set by default.
-Wbidi-char raises
/usr/bin/c++ -DI18N_PHONENUMBERS_USE_ALTERNATE_FORMATS
-DI18N_PHONENUMBERS_USE_ICU_REGEXP
-DI18N_PHONENUMBERS_USE_TR1_UNORDERED_MAP -I/<<PKGBUILDDIR>>/cpp/src
-I/<<PKGBUILDDIR>>/cpp/test -g -O2 -fno-omit-frame-pointer
-mno-omit-leaf-frame-pointer -ffile-prefix-map=/<<PKGBUILDDIR>>=.
-flto=auto -ffat-lto-objects -fstack-protector-strong
-fstack-clash-protection -Wformat -Werror=format-security -fcf-protection
-fdebug-prefix-map=/<<PKGBUILDDIR>>=/usr/src/libphonenumber-8.13.51+ds-4.2build1
-Wdate-time -D_FORTIFY_SOURCE=3 -Wall -Werror -MD -MT
CMakeFiles/libphonenumber_test.dir/test/phonenumbers/phonenumberutil_test.cc.o
-MF
CMakeFiles/libphonenumber_test.dir/test/phonenumbers/phonenumberutil_test.cc.o.d
-o
CMakeFiles/libphonenumber_test.dir/test/phonenumbers/phonenumberutil_test.cc.o
-c /<<PKGBUILDDIR>>/cpp/test/phonenumbers/phonenumberutil_test.cc
/<<PKGBUILDDIR>>/cpp/test/phonenumbers/phonenumberutil_test.cc:1627:43:
error: found problematic Unicode character ‘U+200F (RIGHT-TO-LEFT MARK)’
[-Werror=bidi-chars=]
1627 | /* "(650) 253-0000<U+200F>" */, &extracted_number);
| ^~~~~~~~
cc1plus: all warnings being treated as errors
Where <U+200F> in the code is the properly formatted Unicode character.
The test correctly encodes it, and only the comment contains the unicode
literal. However, -Wbidi-char checks comments as well, as that is a source
for a Trojan Source attack. pragma comments also cannot disable bidi-char
when set via cli or envvar.
Attached is the proposed patch going into Ubuntu, which escapes the
comment. This is also reported upstream with Google, where I suggest
escaping as well.
Upstream: https://partnerissuetracker.corp.google.com/issues/446931058
Ubuntu Bug:
https://bugs.launchpad.net/ubuntu/+source/libphonenumber/+bug/2124964
--
-----------------------
Dr. John Chittum
Engineering Manager, Canonical, Debcrafters
Description: Escape unicode bidi-char in comment
gcc-15 default in Ubuntu runs with -Werror=bidi-char=.
Bidi-char warnings are not supressable with pragma.
Instead, escape the comment into <> instead of [] so it
is not interpreted as unicode.
Author: John Chittum <[email protected]>
Bug: https://partnerissuetracker.corp.google.com/issues/446931058
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libphonenumber/+bug/2124964
Last-Update: 2025-09-23
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/cpp/test/phonenumbers/phonenumberutil_test.cc
+++ b/cpp/test/phonenumbers/phonenumberutil_test.cc
@@ -1623,8 +1623,11 @@
ExtractPossibleNumber("(650) 253-0000.", &extracted_number);
EXPECT_EQ("650) 253-0000", extracted_number);
// This case has a trailing RTL char.
+ // gcc-15+ introduces a new warning for invisible bidi Unicode characters
+ // compiling with gcc-15, -Wbidi-chars -Werror, this test will fail
+ // But it's meant to test a bidi char as it's a generally unsafe thing
ExtractPossibleNumber("(650) 253-0000\xE2\x80\x8F"
- /* "(650) 253-0000" */, &extracted_number);
+ /* "(650) 253-0000<U+200F>" */, &extracted_number);
EXPECT_EQ("650) 253-0000", extracted_number);
}
__
This is the maintainer address of Debian's Java team
<https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-java-maintainers>.
Please use
[email protected] for discussions and questions.