mirror of
https://gitee.com/openharmony/third_party_mesa3d
synced 2024-11-23 07:19:50 +00:00
mesa: prevent common string formatting security issues
Adds a compile-time error for obvious security issues like: printf(string_var); The proposed flag is more tolerant than -Wformat-nonliteral. Specifically, it tolerates common mesa formatting like: static const char *shader_template = "really long string %d"; printf(shader_template, uniform_number); Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110833 Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Engestrom <eric@engestrom.ch>
This commit is contained in:
parent
f4ef34f207
commit
c9c1e26106
@ -849,6 +849,8 @@ c_args = []
|
||||
foreach a : ['-Werror=implicit-function-declaration',
|
||||
'-Werror=missing-prototypes', '-Werror=return-type',
|
||||
'-Werror=incompatible-pointer-types',
|
||||
'-Werror=format',
|
||||
'-Wformat-security',
|
||||
'-fno-math-errno',
|
||||
'-fno-trapping-math', '-Qunused-arguments']
|
||||
if cc.has_argument(a)
|
||||
@ -870,6 +872,8 @@ endif
|
||||
# Check for generic C++ arguments
|
||||
cpp_args = []
|
||||
foreach a : ['-Werror=return-type',
|
||||
'-Werror=format',
|
||||
'-Wformat-security',
|
||||
'-fno-math-errno', '-fno-trapping-math',
|
||||
'-Qunused-arguments']
|
||||
if cpp.has_argument(a)
|
||||
|
Loading…
Reference in New Issue
Block a user