From f1ef05b1219f489fde3cfb55c60ccd3d1884cb5e Mon Sep 17 00:00:00 2001 From: Saleel Kudchadker Date: Tue, 30 Apr 2024 15:45:33 +0000 Subject: [PATCH] SWDEV 301667 - Fix Debug dot print for graphs - Fix possible buffer overflow for long kernel names Change-Id: I3c51669de7ff242d03f9210ee045b6d5e7ac274a --- hipamd/src/hip_graph_internal.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hipamd/src/hip_graph_internal.hpp b/hipamd/src/hip_graph_internal.hpp index 21737110f7..c90902d2f0 100644 --- a/hipamd/src/hip_graph_internal.hpp +++ b/hipamd/src/hip_graph_internal.hpp @@ -831,7 +831,7 @@ class GraphKernelNode : public GraphNode { hipFunction_t func = getFunc(kernelParams_, ihipGetDevice()); hip::DeviceFunc* function = hip::DeviceFunc::asFunction(func); std::string label; - char buffer[500]; + char buffer[4096]; if (flag == hipGraphDebugDotFlagsVerbose) { sprintf(buffer, "{\n%s\n| {ID | %d | %s\\<\\<\\<(%u,%u,%u),(%u,%u,%u),%u\\>\\>\\>}\n| {{node " @@ -1315,7 +1315,7 @@ class GraphMemcpyNode : public GraphNode { } std::string label; if (flag == hipGraphDebugDotFlagsMemcpyNodeParams || flag == hipGraphDebugDotFlagsVerbose) { - char buffer[500]; + char buffer[4096]; sprintf( buffer, "{\n%s\n| {{ID | node handle} | {%u | %p}}\n| {kind | %s}\n| {{srcPtr | dstPtr} | " @@ -1493,7 +1493,7 @@ class GraphMemcpyNode1D : public GraphMemcpyNode { } std::string label; if (flag == hipGraphDebugDotFlagsMemcpyNodeParams || flag == hipGraphDebugDotFlagsVerbose) { - char buffer[500]; + char buffer[4096]; sprintf( buffer, "{\n%s\n| {{ID | node handle} | {%u | %p}}\n| {kind | %s}\n| {{srcPtr | dstPtr} | " @@ -1742,7 +1742,7 @@ class GraphMemsetNode : public GraphNode { virtual std::string GetLabel(hipGraphDebugDotFlags flag) override { std::string label; if (flag == hipGraphDebugDotFlagsMemsetNodeParams || flag == hipGraphDebugDotFlagsVerbose) { - char buffer[500]; + char buffer[4096]; sprintf(buffer, "{\n%s\n| {{ID | node handle | dptr | pitch | value | elementSize | width | " "height | depth} | {%u | %p | %p | %zu | %u | %u | %zu | %zu | %zu}}}",