-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Fix issues found by fuzz testing #6508
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -224,7 +224,7 @@ void load_cfg(const char* filename, std::deque<Section*>& dnet) | |
| section->original_layer_count = section_count++; | ||
| dnet.push_back(section); | ||
| } | ||
| else if ((pos = line.find_first_of('=')) != std::string::npos) | ||
| else if (section && (pos = line.find_first_of('=')) != std::string::npos) | ||
| { | ||
| std::string key = line.substr(0, pos); | ||
| std::string value = line.substr(pos + 1, line.length() - 1); | ||
|
|
@@ -950,5 +950,11 @@ int main(int argc, char** argv) | |
| printf("NOTE: Make sure your pre-processing and post-processing support letter_box.\n"); | ||
| printf("NOTE: Remember to use ncnnoptimize for better performance.\n"); | ||
|
|
||
| for (auto it = dnet.begin(); it != dnet.end(); it++) | ||
| { | ||
| auto s = *it; | ||
| delete s; | ||
| } | ||
|
Comment on lines
+953
to
+957
|
||
|
|
||
| return 0; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -438,7 +438,7 @@ static bool read_mxnet_json(const char* jsonpath, std::vector<MXNetNode>& nodes) | |
| { | ||
| // workaround for potential duplicated _plus0 | ||
| char underscorename[256]; | ||
| sprintf(underscorename, "underscorencnn_%d%s", internal_underscore, n.name.c_str()); | ||
| snprintf(underscorename, 256, "underscorencnn_%d%s", internal_underscore, n.name.c_str()); | ||
|
||
|
|
||
| n.name = underscorename; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The early return value for a null buffer is incorrect. When buffer is null, the function returns 1, which indicates success in this codebase (see line 1698 where successful reading returns 1, and line 1700 where failure returns 0). Returning 1 for a null buffer would indicate that the read operation succeeded when it actually failed. The function should return 0 when buffer is null to properly indicate an error condition.