Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix segmentation fault when idc is default #38

Merged
merged 1 commit into from
Jul 29, 2016

Conversation

akinzhou100
Copy link

idc的默认值需要设置为NULL,要不然会发生段错误,在php-5.6.14下重现代码为
var_dump(Qconf::getBatchConf("/abcd","test"));正常
var_dump(Qconf::getBatchConf("/abcd"));段错误
原因是未对idc进行初始化为为NULL,idc未传值时,这是一个非法指针,以getBatchConf为例,最后实际调的是qconf.cc中的qconf_get_batch_conf_方法,这里有一段代码if (NULL != idc) tmp_idc.assign(idc); 这个显然对一个非法指针进行了操作。
看了下提交历史,应该是之前的一个版本中为兼容php7修改int为size_t时,把idc字符串的初始化也给去掉了。

@CatKang CatKang merged commit 15b7c20 into Qihoo360:master Jul 29, 2016
@CatKang
Copy link
Contributor

CatKang commented Jul 29, 2016

感谢修复

gaodq pushed a commit that referenced this pull request Aug 15, 2018
fix segmentation fault when idc is default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants