From 4ffbef5e42f0de597b61f7306b779cb1dcc094e7 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Tue, 5 Mar 2024 23:09:38 -0500 Subject: [PATCH] Fix mismatched new[] vs free() in Altium parser --- common/io/altium/altium_binary_parser.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/io/altium/altium_binary_parser.h b/common/io/altium/altium_binary_parser.h index 7719814416..1ca7ba49df 100644 --- a/common/io/altium/altium_binary_parser.h +++ b/common/io/altium/altium_binary_parser.h @@ -147,9 +147,10 @@ public: wxScopedCharBuffer ReadCharBuffer() { uint8_t len = Read(); + if( GetRemainingBytes() >= len ) { - char* buf = new char[len]; + char* buf = static_cast( malloc( len ) ); memcpy( buf, m_pos, len ); m_pos += len;