From 3cc6384e41819eb8a5182a9ab7fd8f74d3cea9e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 2 May 2024 15:27:44 +0100 Subject: [PATCH] WaE: C6011 Dereferencing NULL pointer warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ibca9433761e7a7f97383991429cf0d575b4ba3d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167018 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- hwpfilter/source/formula.cxx | 2 ++ hwpfilter/source/lexer.cxx | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hwpfilter/source/formula.cxx b/hwpfilter/source/formula.cxx index e220afe9d881..84982dcd9aae 100644 --- a/hwpfilter/source/formula.cxx +++ b/hwpfilter/source/formula.cxx @@ -580,6 +580,7 @@ void Formula::parse() } char *buf = static_cast(malloc(a.getLength()+1)); + assert(buf && "Don't handle OOM conditions"); bool bStart = false; int i, j; for( i = 0, j=0 ; i < a.getLength() ; i++){ // rtrim and ltrim 32 10 13 @@ -618,6 +619,7 @@ void Formula::trim() { int len = strlen(eq); char *buf = static_cast(malloc(len+1)); + assert(buf && "Don't handle OOM conditions"); bool bStart = false; int i, j; for( i = 0, j=0 ; i < len ; i++){ // rtrim and ltrim 32 10 13 diff --git a/hwpfilter/source/lexer.cxx b/hwpfilter/source/lexer.cxx index cb6ae3fc4b49..844432268d92 100644 --- a/hwpfilter/source/lexer.cxx +++ b/hwpfilter/source/lexer.cxx @@ -220,7 +220,7 @@ typedef int yy_state_type; static yy_state_type yy_get_previous_state YY_PROTO(( )); static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); static int yy_get_next_buffer YY_PROTO(( )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); +[[noreturn]] static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext.