From 4262aea87c3c2287c03e139be95bd510a1638960 Mon Sep 17 00:00:00 2001 From: Jeffrey Song Date: Mon, 13 Jul 2026 11:35:22 -0700 Subject: [PATCH] Internals: Use snprintf for random unique indexes (#7925) --- docs/CONTRIBUTORS | 2 ++ include/verilated_random.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/CONTRIBUTORS b/docs/CONTRIBUTORS index 2305ce3a9..955d22e6a 100644 --- a/docs/CONTRIBUTORS +++ b/docs/CONTRIBUTORS @@ -126,6 +126,8 @@ Jamie Iles Jan Van Winkel Jean Berniolles Jean-Nicolas Strauss +Jeffrey Song +jeffrey.song Jens Yuechao Liu Jeremy Bennett Jesse Taube diff --git a/include/verilated_random.cpp b/include/verilated_random.cpp index e94288fcf..6440067be 100644 --- a/include/verilated_random.cpp +++ b/include/verilated_random.cpp @@ -496,7 +496,7 @@ bool VlRandomizer::next(VlRNG& rngr) { std::string distinctExpr = "(__Vbv (distinct"; for (uint32_t i = 0; i < size; ++i) { char hexIdx[12]; - sprintf(hexIdx, "#x%08x", i); + (void)VL_SNPRINTF(hexIdx, sizeof(hexIdx), "#x%08x", i); distinctExpr += " (select " + it->first + " " + hexIdx + ")"; } distinctExpr += "))";