Initialize de-dup'ed debug line buffer:
realloc(NULL, size) == malloc(size), which is uninitialized space.
This causes the Clang memory sanitizer to detect an attempt to read
uninitialized memory when debug_line_buf and debug_line_buf_last are
different lengths. While the uninitialized space may never actually be
compared, the memory sanitizer emits a strong hint to not do stupid.
The sanitizer trips in the i650 simulator on the first memcmp(),
debug_line_buf has 108 characters, debug_line_buf_last has 56
characters (uninitialized space follows the 56 characters, tripping
the sanitizer.)
- memset() debug_line_buf and debug_line_buf_last to zero so that
memcmp() will always gracefully return non-zero if somehow memcmp()
ends up going past the end of either buffer. Should never happen in
practice, but theory always gets mugged by reality.
- Keep track of debug_line_buf_last's comparison length (i.e., up to
the '\r') and only execute memcmp() when this length equals the
current debug_line_buf comparison length (end - endprefix + 1).
- Added a log deduplication test to "testlib" command to ensure that
nothing broke as a result of this fix.
Network ACL check in sim_addr_acl_check:
The memory sanitizer found an off-by-one bug in sim_addr_acl_check
while executing "testlib". This makes CIDR network ACLs functional,
e.g., "127.0.0.1/32" is interpreted properly and the associated
"testlib" test passes.
This is the codebase of SIMH, a framework and collection of computer system simulators.
SIMH was created by Bob Supnik, originally at Digital Equipment Corporation, and extended by contributions of many other people. It is now an open source project, licensed under an MIT open source license (see LICENSE.txt for the specific wording). The project gatekeepers are the members of the SIMH Steering Group. We welcome and encourage contributions from all. Contributions will be covered by the project license.
The Open SIMH code base was taken from a code base maintained by Mark Pizzolato as of 12 May 2022. From that point onward there is no connection between that source and the Open SIMH code base. A detailed listing of features as of that point may be found in SIMH-V4-status.
PLEASE NOTE
Do not contribute material taken from github.com/simh/simh unless you are the author of the material in question.