https://git.reactos.org/?p=reactos.git;a=commitdiff;h=09c4d0a74b2362e2c9d29ec87c54ecc3bddd5b79

commit 09c4d0a74b2362e2c9d29ec87c54ecc3bddd5b79
Author:     Hervé Poussineau <hpous...@reactos.org>
AuthorDate: Sat Apr 6 23:35:37 2019 +0200
Commit:     Hervé Poussineau <hpous...@reactos.org>
CommitDate: Sun Apr 7 18:32:29 2019 +0200

    [CMAKE] Prevent out-of-bound accesses in parser/lexer files
    
    which try to remove path prefix from them.
---
 base/applications/winhlp32/CMakeLists.txt      | 3 +++
 dll/directx/wine/d3dcompiler_43/CMakeLists.txt | 8 ++++++++
 dll/win32/jscript/CMakeLists.txt               | 3 +++
 dll/win32/msi/CMakeLists.txt                   | 3 +++
 dll/win32/msxml3/CMakeLists.txt                | 3 +++
 dll/win32/vbscript/CMakeLists.txt              | 3 +++
 dll/win32/wbemprox/CMakeLists.txt              | 3 +++
 7 files changed, 26 insertions(+)

diff --git a/base/applications/winhlp32/CMakeLists.txt 
b/base/applications/winhlp32/CMakeLists.txt
index cb4ee2e72a..9a17ba1a13 100644
--- a/base/applications/winhlp32/CMakeLists.txt
+++ b/base/applications/winhlp32/CMakeLists.txt
@@ -15,6 +15,9 @@ list(APPEND SOURCE
     winhelp.c
     precomp.h)
 
+# macro.lex.yy.c has been generated with relative file paths...
+set_source_files_properties(macro.lex.yy.c PROPERTIES COMPILE_FLAGS 
"-UREACTOS_SOURCE_DIR -DREACTOS_SOURCE_DIR=\"\\\".\\\"\"")
+
 add_rc_deps(rsrc.rc ${CMAKE_CURRENT_SOURCE_DIR}/res/winhelp.ico)
 add_executable(winhlp32 ${SOURCE} string.c rsrc.rc)
 set_module_type(winhlp32 win32gui)
diff --git a/dll/directx/wine/d3dcompiler_43/CMakeLists.txt 
b/dll/directx/wine/d3dcompiler_43/CMakeLists.txt
index 49d18b0b07..7091dc22cf 100644
--- a/dll/directx/wine/d3dcompiler_43/CMakeLists.txt
+++ b/dll/directx/wine/d3dcompiler_43/CMakeLists.txt
@@ -26,6 +26,14 @@ add_library(d3dcompiler_43 MODULE
     version.rc
     ${CMAKE_CURRENT_BINARY_DIR}/d3dcompiler_43.def)
 
+# some files have been generated with relative file paths...
+set_source_files_properties(
+    asmshader.tab.c
+    asmshader.yy.c
+    hlsl.tab.c
+    hlsl.yy.c
+    PROPERTIES COMPILE_FLAGS "-UREACTOS_SOURCE_DIR 
-DREACTOS_SOURCE_DIR=\"\\\".\\\"\"")
+
 set_module_type(d3dcompiler_43 win32dll)
 target_link_libraries(d3dcompiler_43 dx10guid uuid wine wpp)
 add_importlibs(d3dcompiler_43 msvcrt kernel32 ntdll)
diff --git a/dll/win32/jscript/CMakeLists.txt b/dll/win32/jscript/CMakeLists.txt
index 40a48d570b..7f0a036af5 100644
--- a/dll/win32/jscript/CMakeLists.txt
+++ b/dll/win32/jscript/CMakeLists.txt
@@ -35,6 +35,9 @@ list(APPEND SOURCE
     vbarray.c
     precomp.h)
 
+# cc_parser.tab.c/parser.tab.c have been generated with relative file paths...
+set_source_files_properties(cc_parser.tab.c parser.tab.c PROPERTIES 
COMPILE_FLAGS "-UREACTOS_SOURCE_DIR -DREACTOS_SOURCE_DIR=\"\\\".\\\"\"")
+
 list(APPEND jscript_rc_deps
     ${CMAKE_CURRENT_SOURCE_DIR}/jscript.rgs
     ${CMAKE_CURRENT_SOURCE_DIR}/jscript_classes.rgs
diff --git a/dll/win32/msi/CMakeLists.txt b/dll/win32/msi/CMakeLists.txt
index b2e6bf72f7..10d1fb1797 100644
--- a/dll/win32/msi/CMakeLists.txt
+++ b/dll/win32/msi/CMakeLists.txt
@@ -51,6 +51,9 @@ list(APPEND SOURCE
     where.c
     precomp.h)
 
+# cond.tab.c/sql.tab.c have been generated with relative file paths...
+set_source_files_properties(cond.tab.c sql.tab.c PROPERTIES COMPILE_FLAGS 
"-UREACTOS_SOURCE_DIR -DREACTOS_SOURCE_DIR=\"\\\".\\\"\"")
+
 add_library(msi MODULE
     ${SOURCE}
     ${CMAKE_CURRENT_BINARY_DIR}/msiserver_i.c
diff --git a/dll/win32/msxml3/CMakeLists.txt b/dll/win32/msxml3/CMakeLists.txt
index 7abb691b21..a5cb75b295 100644
--- a/dll/win32/msxml3/CMakeLists.txt
+++ b/dll/win32/msxml3/CMakeLists.txt
@@ -52,6 +52,9 @@ list(APPEND SOURCE
     precomp.h
     ${CMAKE_CURRENT_BINARY_DIR}/msxml3_stubs.c)
 
+# xslpattern.tab.c/xslpattern.yy.c have been generated with relative file 
paths...
+set_source_files_properties(xslpattern.tab.c xslpattern.yy.c PROPERTIES 
COMPILE_FLAGS "-UREACTOS_SOURCE_DIR -DREACTOS_SOURCE_DIR=\"\\\".\\\"\"")
+
 list(APPEND msxml3_rc_deps
     ${CMAKE_CURRENT_SOURCE_DIR}/msxml3.manifest
     ${CMAKE_CURRENT_SOURCE_DIR}/msxml3_v1.rgs
diff --git a/dll/win32/vbscript/CMakeLists.txt 
b/dll/win32/vbscript/CMakeLists.txt
index d562befb46..999d7edceb 100644
--- a/dll/win32/vbscript/CMakeLists.txt
+++ b/dll/win32/vbscript/CMakeLists.txt
@@ -17,6 +17,9 @@ list(APPEND SOURCE
     vbscript_main.c
     precomp.h)
 
+# parser.tab.c has been generated with relative file paths...
+set_source_files_properties(parser.tab.c PROPERTIES COMPILE_FLAGS 
"-UREACTOS_SOURCE_DIR -DREACTOS_SOURCE_DIR=\"\\\".\\\"\"")
+
 list(APPEND vbscript_rc_deps
     ${CMAKE_CURRENT_SOURCE_DIR}/vbscript_classes.rgs
     ${CMAKE_CURRENT_SOURCE_DIR}/vbsglobal.rgs
diff --git a/dll/win32/wbemprox/CMakeLists.txt 
b/dll/win32/wbemprox/CMakeLists.txt
index d11bb0da53..a59647739e 100644
--- a/dll/win32/wbemprox/CMakeLists.txt
+++ b/dll/win32/wbemprox/CMakeLists.txt
@@ -22,6 +22,9 @@ list(APPEND SOURCE
     wql.tab.c
     precomp.h)
 
+# wql.tab.c has been generated with relative file paths...
+set_source_files_properties(wql.tab.c PROPERTIES COMPILE_FLAGS 
"-UREACTOS_SOURCE_DIR -DREACTOS_SOURCE_DIR=\"\\\".\\\"\"")
+
 add_library(wbemprox MODULE
     ${SOURCE}
     guid.c

Reply via email to