Uninitialized data written to dependency file, if executable is found from PATH
$bin = $basename; # Find in PATHWhen this happens, verilator_bin is called with argv0 set to just "verilator_bin". This adds "verilator_bin" as a dependency and then when V3FileDependImp::writeTimes() is called, loadStats() will try to stat("verilator_bin") and fail (stat doesn't search PATH), but this failure isn't checked and writeTimes() will write data from uninitialized memory to the dependency file.
It's simple enough to check for failure but it would be good to write the correct dependency. One way would be to do the PATH lookup explicitly, either in the Perl wrapper or in the executable, but a neater solution under Linux might be to ignore argv0 and use readlink("/proc/self/exe") to get the actual executable name.
#2 Updated by Wilson Snyder 9 months ago
- Category set to TranslationError
- Status changed from New to Resolved
- Assignee set to Wilson Snyder
Uninit problem fixed in git towards 4.010.
I tried a patch using the exe name, but this causes a problem in that generated makefiles use the whole pathname which breaks some distributed build systems with differing paths. It's also not easily portable to windows.
Also available in: Atom