You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Perl script (i.e. "verilator") tries various ways to find the executable ("verilator_bin") one of which is to fall back to PATH:
$bin = $basename; # Find in PATH
When this happens, verilator_bin is called with argv[0] 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 argv[0] and use readlink("/proc/self/exe") to get the actual executable name.
The text was updated successfully, but these errors were encountered:
Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-01-05T09:58:17Z
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.
Author Name: Al Grant
Original Redmine Issue: 1385 from https://www.veripool.org
Original Assignee: Wilson Snyder (@wsnyder)
The Perl script (i.e. "verilator") tries various ways to find the executable ("verilator_bin") one of which is to fall back to PATH:
When this happens, verilator_bin is called with argv[0] 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 argv[0] and use readlink("/proc/self/exe") to get the actual executable name.
The text was updated successfully, but these errors were encountered: