From 60e76b2da4b4ec2047f978bd947bedf8dba1956e Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Tue, 28 Apr 2026 13:28:21 +0200 Subject: [PATCH] Avoid UB if `new` OOMs by removing `std:nothrow` --- src/asm/lexer.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/asm/lexer.cpp b/src/asm/lexer.cpp index b273cc4a..990bfc9c 100644 --- a/src/asm/lexer.cpp +++ b/src/asm/lexer.cpp @@ -12,7 +12,6 @@ #include #include #include -#include // nothrow #include #include #include @@ -347,7 +346,7 @@ void LexerState::setFileAsNextState(std::string const &filePath, bool updateStat // Read the entire file for better performance // Ideally we'd use C++20 `auto ptr = std::make_shared(size)`, // but it has insufficient compiler support - auto ptr = std::shared_ptr(new (std::nothrow) char[size]); + auto ptr = std::shared_ptr(new char[size]); if (std::ifstream fs(path, std::ios::binary); !fs) { // LCOV_EXCL_START