Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8412b17

Browse files
authored
fix segv about skip_next, warn on unsupported cases of linking options (#1958)
1 parente9621db commit8412b17

File tree

1 file changed

+59
-1
lines changed

1 file changed

+59
-1
lines changed

‎src/afl-cc.c‎

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1982,7 +1982,7 @@ param_st parse_linking_params(aflcc_state_t *aflcc, u8 *cur_argv, u8 scan,
19821982
}elseif (!strcmp(cur_argv,"-z")|| !strcmp(cur_argv,"-Wl,-z")) {
19831983

19841984
u8*param=*(argv+1);
1985-
if (!strcmp(param,"defs")|| !strcmp(param,"-Wl,defs")) {
1985+
if (param&& (!strcmp(param,"defs")|| !strcmp(param,"-Wl,defs"))) {
19861986

19871987
*skip_next=1;
19881988

@@ -2000,6 +2000,64 @@ param_st parse_linking_params(aflcc_state_t *aflcc, u8 *cur_argv, u8 scan,
20002000

20012001
}
20022002

2003+
// Try to warn user for some unsupported cases
2004+
if (scan&&final_==PARAM_MISS) {
2005+
2006+
u8*ptr_=NULL;
2007+
2008+
if (!strcmp(cur_argv,"-Xlinker")&& (ptr_=*(argv+1))) {
2009+
2010+
if (!strcmp(ptr_,"defs")) {
2011+
2012+
WARNF("'-Xlinker' 'defs' detected. This may result in a bad link.");
2013+
2014+
}elseif (strstr(ptr_,"-no-undefined")) {
2015+
2016+
WARNF(
2017+
"'-Xlinker' '%s' detected. The latter option may be dropped and "
2018+
"result in a bad link.",
2019+
ptr_);
2020+
2021+
}
2022+
2023+
}elseif (!strncmp(cur_argv,"-Wl,",4)&&
2024+
2025+
(u8*)strrchr(cur_argv,',')!= (cur_argv+3)) {
2026+
2027+
ptr_=cur_argv+4;
2028+
2029+
if (strstr(ptr_,"-shared")||strstr(ptr_,"-dynamiclib")) {
2030+
2031+
WARNF(
2032+
"'%s': multiple link options after '-Wl,' may break shared "
2033+
"linking.",
2034+
ptr_);
2035+
2036+
}
2037+
2038+
if (strstr(ptr_,"-r,")||strstr(ptr_,"-i,")||strstr(ptr_,",-r")||
2039+
strstr(ptr_,",-i")||strstr(ptr_,"--relocatable")) {
2040+
2041+
WARNF(
2042+
"'%s': multiple link options after '-Wl,' may break partial "
2043+
"linking.",
2044+
ptr_);
2045+
2046+
}
2047+
2048+
if (strstr(ptr_,"defs")||strstr(ptr_,"no-undefined")) {
2049+
2050+
WARNF(
2051+
"'%s': multiple link options after '-Wl,' may enable report "
2052+
"unresolved symbol references and result in a bad link.",
2053+
ptr_);
2054+
2055+
}
2056+
2057+
}
2058+
2059+
}
2060+
20032061
if (final_==PARAM_KEEP)insert_param(aflcc,cur_argv);
20042062

20052063
returnfinal_;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp