Skip to content

Commit cc9ba81

Browse files
author
Michal Klocek
committed
[backport] Security bug 408294914
Roll src/third_party/expat/src/ 624da0f59..69d6c054c (275 commits) Bug: 408294914 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6433146 Change-Id: I9fd36ac6f545eb7844ba49ffbec161b090c3cd25 Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/650320 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
1 parent 715258e commit cc9ba81

File tree

26 files changed

+859
-292
lines changed

26 files changed

+859
-292
lines changed

chromium/third_party/expat/include/expat_config/expat_config.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
/* Define to 1 if you have the <fcntl.h> header file. */
2626
#define HAVE_FCNTL_H 1
2727

28-
/* Define to 1 if you have the `getpagesize' function. */
28+
/* Define to 1 if you have the 'getpagesize' function. */
2929
#define HAVE_GETPAGESIZE 1
3030

3131
/* Define to 1 if you have the `getrandom' function. */
@@ -34,10 +34,10 @@
3434
/* Define to 1 if you have the <inttypes.h> header file. */
3535
#define HAVE_INTTYPES_H 1
3636

37-
/* Define to 1 if you have the `bsd' library (-lbsd). */
37+
/* Define to 1 if you have the 'bsd' library (-lbsd). */
3838
/* #undef HAVE_LIBBSD */
3939

40-
/* Define to 1 if you have a working `mmap' system call. */
40+
/* Define to 1 if you have a working 'mmap' system call. */
4141
#define HAVE_MMAP 1
4242

4343
/* Define to 1 if you have the <stdint.h> header file. */
@@ -83,7 +83,7 @@
8383
#define PACKAGE_NAME "expat"
8484

8585
/* Define to the full name and version of this package. */
86-
#define PACKAGE_STRING "expat 2.6.3"
86+
#define PACKAGE_STRING "expat 2.7.1"
8787

8888
/* Define to the one symbol short name of this package. */
8989
#define PACKAGE_TARNAME "expat"
@@ -92,15 +92,15 @@
9292
#define PACKAGE_URL ""
9393

9494
/* Define to the version of this package. */
95-
#define PACKAGE_VERSION "2.6.3"
95+
#define PACKAGE_VERSION "2.7.1"
9696

97-
/* Define to 1 if all of the C90 standard headers exist (not just the ones
97+
/* Define to 1 if all of the C89 standard headers exist (not just the ones
9898
required in a freestanding environment). This macro is provided for
9999
backward compatibility; new code need not use it. */
100100
#define STDC_HEADERS 1
101101

102102
/* Version number of package */
103-
#define VERSION "2.6.3"
103+
#define VERSION "2.7.1"
104104

105105
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
106106
significant byte first (like Motorola and SPARC, unlike Intel). */
@@ -134,10 +134,10 @@
134134
/* Define to make XML Namespaces functionality available. */
135135
#define XML_NS 1
136136

137-
/* Define to empty if `const' does not conform to ANSI C. */
137+
/* Define to empty if 'const' does not conform to ANSI C. */
138138
/* #undef const */
139139

140-
/* Define to `long int' if <sys/types.h> does not define. */
140+
/* Define to 'long int' if <sys/types.h> does not define. */
141141
/* #undef off_t */
142142

143143
#endif // ndef EXPAT_CONFIG_H

chromium/third_party/expat/src/.ci.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ if [[ ${RUNNER_OS} = macOS ]]; then
3939
latest_brew_python3_bin="$(ls -1d /usr/local/Cellar/python/3.*/bin | sort -n | tail -n1)"
4040
export PATH="${latest_brew_python3_bin}${PATH:+:}${PATH}"
4141
elif [[ ${RUNNER_OS} = Linux ]]; then
42-
export PATH="/usr/lib/llvm-18/bin:${PATH}"
42+
export PATH="/usr/lib/llvm-19/bin:${PATH}"
4343
else
4444
echo "Unsupported RUNNER_OS \"${RUNNER_OS}\"." >&2
4545
exit 1

chromium/third_party/expat/src/COPYING

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Copyright (c) 1998-2000 Thai Open Source Software Center Ltd and Clark Cooper
2-
Copyright (c) 2001-2022 Expat maintainers
2+
Copyright (c) 2001-2025 Expat maintainers
33

44
Permission is hereby granted, free of charge, to any person obtaining
55
a copy of this software and associated documentation files (the

chromium/third_party/expat/src/expat/CMake.README

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@
33
The cmake based buildsystem for expat works on Windows (cygwin, mingw, Visual
44
Studio) and should work on all other platform cmake supports.
55

6-
Assuming ~/expat-2.6.3 is the source directory of expat, add a subdirectory
6+
Assuming ~/expat-2.7.1 is the source directory of expat, add a subdirectory
77
build and change into that directory:
8-
~/expat-2.6.3$ mkdir build && cd build
9-
~/expat-2.6.3/build$
8+
~/expat-2.7.1$ mkdir build && cd build
9+
~/expat-2.7.1/build$
1010

1111
From that directory, call cmake first, then call make, make test and
1212
make install in the usual way:
13-
~/expat-2.6.3/build$ cmake ..
13+
~/expat-2.7.1/build$ cmake ..
1414
-- The C compiler identification is GNU
1515
-- The CXX compiler identification is GNU
1616
....
1717
-- Configuring done
1818
-- Generating done
19-
-- Build files have been written to: /home/patrick/expat-2.6.3/build
19+
-- Build files have been written to: /home/patrick/expat-2.7.1/build
2020

2121
If you want to specify the install location for your files, append
2222
-DCMAKE_INSTALL_PREFIX=/your/install/path to the cmake call.
2323

24-
~/expat-2.6.3/build$ make && make test && make install
24+
~/expat-2.7.1/build$ make && make test && make install
2525
Scanning dependencies of target expat
2626
[ 5%] Building C object CMakeFiles/expat.dir/lib/xmlparse.c.o
2727
[ 11%] Building C object CMakeFiles/expat.dir/lib/xmlrole.c.o

chromium/third_party/expat/src/expat/CMakeLists.txt

Lines changed: 80 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
# Copyright (c) 2010 Patrick Spendrin <ps_ml@gmx.de>
99
# Copyright (c) 2012 Karl Waclawek <karl@waclawek.net>
10-
# Copyright (c) 2016-2024 Sebastian Pipping <sebastian@pipping.org>
10+
# Copyright (c) 2016-2025 Sebastian Pipping <sebastian@pipping.org>
1111
# Copyright (c) 2016 Sergei Nikulov <sergey.nikulov@gmail.com>
1212
# Copyright (c) 2016 Björn Lindahl <bjorn.lindahl@foi.se>
1313
# Copyright (c) 2016 Tobias Taschner <github@tc84.de>
@@ -30,15 +30,16 @@
3030
# Copyright (c) 2020 Thomas Beutlich <tc@tbeu.de>
3131
# Copyright (c) 2021 Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
3232
# Copyright (c) 2022 Johnny Jazeix <jazeix@gmail.com>
33+
# Copyright (c) 2022 Mark Brand <markbrand@google.com>
3334
# Copyright (c) 2022 David Faure <david.faure@kdab.com>
3435
# Unlike most of Expat,
3536
# this file is copyrighted under the BSD-license for buildsystem files of KDE.
3637

37-
cmake_minimum_required(VERSION 3.5.0)
38+
cmake_minimum_required(VERSION 3.13.0)
3839

3940
project(expat
4041
VERSION
41-
2.6.3
42+
2.7.1
4243
LANGUAGES
4344
C
4445
)
@@ -134,7 +135,7 @@ expat_shy_set(EXPAT_SHARED_LIBS ${_EXPAT_SHARED_LIBS_DEFAULT} CACHE BOOL "Build
134135
expat_shy_set(EXPAT_BUILD_DOCS ${_EXPAT_BUILD_DOCS_DEFAULT} CACHE BOOL "Build man page for xmlwf")
135136
expat_shy_set(EXPAT_BUILD_FUZZERS OFF CACHE BOOL "Build fuzzers for the expat library")
136137
expat_shy_set(EXPAT_BUILD_PKGCONFIG ${_EXPAT_BUILD_PKGCONFIG_DEFAULT} CACHE BOOL "Build pkg-config file")
137-
expat_shy_set(EXPAT_OSSFUZZ_BUILD OFF CACHE BOOL "Build fuzzers via ossfuzz for the expat library")
138+
expat_shy_set(EXPAT_OSSFUZZ_BUILD OFF CACHE BOOL "Build fuzzers via OSS-Fuzz for the expat library")
138139
if(UNIX OR _EXPAT_HELP)
139140
expat_shy_set(EXPAT_WITH_LIBBSD OFF CACHE BOOL "Utilize libbsd (for arc4random_buf)")
140141
endif()
@@ -169,11 +170,15 @@ if(NOT _EXPAT_HELP)
169170
mark_as_advanced(_EXPAT_M32)
170171
endif()
171172

172-
if(EXPAT_BUILD_TESTS)
173+
if(EXPAT_BUILD_TESTS OR EXPAT_BUILD_FUZZERS)
173174
# We have to call enable_language() before modifying any CMAKE_CXX_* variables
174175
enable_language(CXX)
175176

176-
set(CMAKE_CXX_STANDARD 11)
177+
if (EXPAT_BUILD_FUZZERS)
178+
set(CMAKE_CXX_STANDARD 17) # for std::string_view for Abseil for libprotobuf-mutator
179+
else()
180+
set(CMAKE_CXX_STANDARD 11)
181+
endif()
177182
set(CMAKE_CXX_STANDARD_REQUIRED ON)
178183
set(CMAKE_CXX_EXTENSIONS OFF) # i.e. -std=c++11 rather than default -std=gnu++11
179184
endif()
@@ -320,7 +325,7 @@ if(FLAG_VISIBILITY)
320325
endif()
321326
set(EXTRA_COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -fvisibility=hidden")
322327
endif()
323-
if(MINGW)
328+
if(MINGW AND ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU"))
324329
# Without __USE_MINGW_ANSI_STDIO the compiler produces a false positive
325330
set(EXTRA_COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -Wno-pedantic-ms-format")
326331
endif()
@@ -425,6 +430,7 @@ else()
425430
endif()
426431

427432
add_library(expat ${_SHARED} ${_EXPAT_C_SOURCES} ${_EXPAT_EXTRA_SOURCES})
433+
add_library(expat::expat ALIAS expat)
428434
if(_EXPAT_LIBM_FOUND)
429435
target_link_libraries(expat m)
430436
endif()
@@ -465,9 +471,9 @@ foreach(build_type_upper
465471
set_property(TARGET expat PROPERTY ${build_type_upper}_POSTFIX ${EXPAT_${build_type_upper}_POSTFIX})
466472
endforeach()
467473

468-
set(LIBCURRENT 10) # sync
469-
set(LIBREVISION 3) # with
470-
set(LIBAGE 9) # configure.ac!
474+
set(LIBCURRENT 11) # sync
475+
set(LIBREVISION 2) # with
476+
set(LIBAGE 10) # configure.ac!
471477
math(EXPR LIBCURRENT_MINUS_AGE "${LIBCURRENT} - ${LIBAGE}")
472478

473479
if(NOT WIN32)
@@ -586,7 +592,7 @@ if(EXPAT_BUILD_TOOLS)
586592

587593
if(MINGW AND _EXPAT_UNICODE_WCHAR_T)
588594
# https://gcc.gnu.org/onlinedocs/gcc/x86-Windows-Options.html
589-
set_target_properties(xmlwf PROPERTIES LINK_FLAGS -municode)
595+
target_link_options(xmlwf PRIVATE -municode)
590596
endif()
591597

592598
if(EXPAT_BUILD_DOCS)
@@ -723,7 +729,7 @@ if(EXPAT_BUILD_FUZZERS)
723729
message(SEND_ERROR
724730
"OSS-Fuzz builds require the environment variable "
725731
"LIB_FUZZING_ENGINE to be set. If you are seeing this "
726-
"warning, it points to a deeper problem in the ossfuzz "
732+
"warning, it points to a deeper problem in the OSS-Fuzz "
727733
"build setup.")
728734
endif()
729735

@@ -742,24 +748,78 @@ if(EXPAT_BUILD_FUZZERS)
742748
target_link_libraries(${target_name} fuzzpat)
743749
target_compile_definitions(${target_name}
744750
PRIVATE ENCODING_FOR_FUZZING=${encoding_type})
745-
if(NOT EXPAT_OSSFUZZ_BUILD)
746-
target_compile_options(${target_name} PRIVATE -fsanitize=fuzzer-no-link)
747-
endif()
748-
# NOTE: Avoiding target_link_options here only because it needs CMake >=3.13
749751
if(EXPAT_OSSFUZZ_BUILD)
750-
set_target_properties(${target_name} PROPERTIES LINK_FLAGS $ENV{LIB_FUZZING_ENGINE})
752+
target_link_options(${target_name} PRIVATE $ENV{LIB_FUZZING_ENGINE})
751753
set_target_properties(${target_name} PROPERTIES LINKER_LANGUAGE "CXX")
752754
else()
753-
set_target_properties(${target_name} PROPERTIES LINK_FLAGS -fsanitize=fuzzer)
755+
target_compile_options(${target_name} PRIVATE -fsanitize=fuzzer)
756+
target_link_options(${target_name} PRIVATE -fsanitize=fuzzer)
754757
endif()
755758
set_property(
756759
TARGET ${target_name} PROPERTY RUNTIME_OUTPUT_DIRECTORY fuzz)
757760
endforeach()
758761
endforeach()
762+
763+
find_package(Protobuf REQUIRED)
764+
765+
# Only include libprotobuf-mutator here so we don't build it in non-fuzz
766+
# configurations.
767+
include(ExternalProject)
768+
769+
set(ProtobufMutator_PREFIX libprotobuf-mutator)
770+
set(ProtobufMutator_PATH ${CMAKE_CURRENT_BINARY_DIR}/${ProtobufMutator_PREFIX}/src/${ProtobufMutator_PREFIX})
771+
set(ProtobufMutator_BUILD_PATH ${ProtobufMutator_PATH}-build)
772+
set(ProtobufMutator_INCLUDE_DIR ${ProtobufMutator_PATH})
773+
set(ProtobufMutator_LIBRARIES ${ProtobufMutator_BUILD_PATH}/src/libfuzzer/libprotobuf-mutator-libfuzzer.a ${ProtobufMutator_BUILD_PATH}/src/libprotobuf-mutator.a)
774+
775+
ExternalProject_Add(
776+
${ProtobufMutator_PREFIX}
777+
PREFIX ${ProtobufMutator_PREFIX}
778+
GIT_REPOSITORY https://github.com/google/libprotobuf-mutator.git
779+
GIT_TAG 57928f41ae52bb27666aa15b310130d086dac245 # v1.4-16-g57928f4
780+
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
781+
CMAKE_CACHE_ARGS
782+
-DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
783+
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
784+
-DLIB_PROTO_MUTATOR_EXAMPLES:BOOL=OFF
785+
-DLIB_PROTO_MUTATOR_TESTING:BOOL=OFF
786+
BUILD_BYPRODUCTS ${ProtobufMutator_LIBRARIES}
787+
UPDATE_COMMAND true
788+
INSTALL_COMMAND true)
789+
790+
# Check for availability of protobuf compiler to avoid hard-to-understand
791+
# errors from make(1) down the line as seen with CMake 3.25.1 on Debian
792+
if(NOT Protobuf_PROTOC_EXECUTABLE)
793+
message(SEND_ERROR
794+
"The protobuf compiler (protoc) could not be found. "
795+
"Is it installed and working properly?")
796+
endif()
797+
798+
protobuf_generate_cpp(XML_LPM_FUZZER_PROTO_SRCS
799+
XML_LPM_FUZZER_PROTO_HDRS
800+
fuzz/xml_lpm_fuzzer.proto)
801+
802+
add_executable(xml_lpm_fuzzer
803+
fuzz/xml_lpm_fuzzer.cpp
804+
${XML_LPM_FUZZER_PROTO_SRCS})
805+
target_include_directories(xml_lpm_fuzzer PUBLIC ${ProtobufMutator_INCLUDE_DIR})
806+
target_link_libraries(xml_lpm_fuzzer
807+
fuzzpat
808+
${ProtobufMutator_LIBRARIES}
809+
${Protobuf_LIBRARIES})
810+
add_dependencies(xml_lpm_fuzzer ${ProtobufMutator_PREFIX})
811+
812+
if(EXPAT_OSSFUZZ_BUILD)
813+
target_link_options(xml_lpm_fuzzer PRIVATE $ENV{LIB_FUZZING_ENGINE})
814+
else()
815+
target_compile_options(xml_lpm_fuzzer PRIVATE -fsanitize=fuzzer)
816+
target_link_options(xml_lpm_fuzzer PRIVATE -fsanitize=fuzzer)
817+
endif()
818+
set_property(TARGET xml_lpm_fuzzer PROPERTY RUNTIME_OUTPUT_DIRECTORY fuzz)
759819
else()
760820
if(EXPAT_OSSFUZZ_BUILD)
761821
message(SEND_ERROR
762-
"Attempting to perform an ossfuzz build without turning on the fuzzer build. "
822+
"Attempting to perform an OSS-Fuzz build without turning on the fuzzer build. "
763823
"This is likely in error - consider adding "
764824
"-DEXPAT_BUILD_FUZZERS=ON to your cmake execution.")
765825
endif()
@@ -912,13 +972,7 @@ elseif(EXPAT_CHAR_TYPE STREQUAL "wchar_t")
912972
else()
913973
set(_EXPAT_CHAR_TYPE_SUMMARY "ERROR")
914974
endif()
915-
# NOTE: We're not accessing global property GENERATOR_IS_MULTI_CONFIG
916-
# because that would require CMake >=3.9
917-
if(CMAKE_CONFIGURATION_TYPES)
918-
set(_EXPAT_GENERATOR_IS_MULTI_CONFIG TRUE)
919-
else()
920-
set(_EXPAT_GENERATOR_IS_MULTI_CONFIG FALSE)
921-
endif()
975+
get_property(_EXPAT_GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
922976

923977
message(STATUS "===========================================================================")
924978
message(STATUS "")

chromium/third_party/expat/src/expat/COPYING

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Copyright (c) 1998-2000 Thai Open Source Software Center Ltd and Clark Cooper
2-
Copyright (c) 2001-2022 Expat maintainers
2+
Copyright (c) 2001-2025 Expat maintainers
33

44
Permission is hereby granted, free of charge, to any person obtaining
55
a copy of this software and associated documentation files (the

0 commit comments

Comments
 (0)