Skip to content

Commit

Permalink
Account for Truncated Signatures in a JITServerHelpers Assertion
Browse files Browse the repository at this point in the history
Add additional checks so that the
assertion "(memcmp(dst, str, J9UTF8_TOTAL_SIZE(str)) == 0)"
in packCallBack() also accounts for the dst signature being
truncated for generated classes. Prevents the non-fatal
assertion from failing.

Fixes #20046

Signed-off-by: Luke Li <[email protected]>
  • Loading branch information
luke-li-2003 committed Jan 3, 2025
1 parent 4c82e0a commit bdc25ec
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion runtime/compiler/control/JITServerHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,15 @@ packCallback(const J9ROMClass *romClass, const J9SRP *origSrp, const char *slotN
if (dst == ctx._cursor)
ctx._cursor += copyUTF8((J9UTF8 *)dst, str, it->second.second/*truncate*/ ? ctx._generatedPrefixLength : 0);
else
TR_ASSERT((dst < ctx._cursor) && (memcmp(dst, str, J9UTF8_TOTAL_SIZE(str)) == 0), "Must be already copied");
TR_ASSERT(
(dst < ctx._cursor) && (
(it->second.second && (memcmp(utf8Data((J9UTF8 *) dst),
utf8Data((J9UTF8 *) str),
ctx._generatedPrefixLength) == 0)) ||
(!it->second.second && (memcmp(dst, str, J9UTF8_TOTAL_SIZE(str)) == 0))
),
"Must be already copied"
);
}

static void
Expand Down

0 comments on commit bdc25ec

Please sign in to comment.