From f5aba929975ce215d8d6b2a41c6d9e9ec23bc552 Mon Sep 17 00:00:00 2001 From: Leonardo Banderali Date: Tue, 9 Mar 2021 09:13:00 -0500 Subject: [PATCH] Increase size of buffer in block validation Previously, a buffer size of 100 characters was passed to sprintf in the block validator. However, the format string itself is 94 characters, which doesn't leave enough room in the buffer for the print arguments. As a result, running the block validator (e.g. with paranoidOptCheck) can lead to a buffer overflow. This commit fixes the issue by increasing the size of the buffer to 150 characters. Signed-off-by: Leonardo Banderali --- compiler/ras/Tree.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/ras/Tree.cpp b/compiler/ras/Tree.cpp index 79b3f5218c8..81453199981 100644 --- a/compiler/ras/Tree.cpp +++ b/compiler/ras/Tree.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2020 IBM Corp. and others + * Copyright (c) 2000, 2021 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -2595,8 +2595,8 @@ TR_Debug::verifyBlocksPass2(TR::Node *node) if (node->getLocalIndex() != 0) { - char buffer[100]; - sprintf(buffer, "BLOCK VERIFICATION ERROR -- node [%s] accessed outside of its (extended) basic block: %d time(s)", + char buffer[150]; + sprintf(buffer, "BLOCK VERIFICATION ERROR -- node [%s] accessed outside of its (extended) basic block: %d time(s)\n", getName(node), node->getLocalIndex()); if (getFile() != NULL) trfprintf(getFile(), buffer);