Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ddprof-lib/src/main/cpp/arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ const char *Arguments::file() {
// Should match statically computed HASH(arg)
long long Arguments::hash(const char *arg) {
long long h = 0;
for (int shift = 0; *arg != 0; shift += 5) {
for (int shift = 0; *arg != 0 && shift < 60; shift += 5) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject overlong option suffixes

For arguments longer than 12 characters, this now silently ignores the rest of the option name, so malformed inputs whose first twelve bytes collide with a valid CASE are accepted instead of being recorded as _unknown_arg. For example, start x hashes the same as start because the seven spaces occupy the remaining hashed slots and the trailing x is discarded, which sets ACTION_START with no unknown-argument warning; overlong names should instead produce a non-matching hash once *arg remains after the 12th character.

Useful? React with 👍 / 👎.

h |= (*arg++ & 31LL) << shift;
}
return h;
Expand Down
Loading