From f97fed7daa9dc0d5e6b96a9292b088ba191917f6 Mon Sep 17 00:00:00 2001 From: peri4 Date: Mon, 13 May 2024 22:29:22 +0300 Subject: [PATCH] string append more protection --- CMakeLists.txt | 2 +- libs/main/text/pistring.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4fb32476..e449e789 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_policy(SET CMP0017 NEW) # need include() with .cmake project(PIP) set(PIP_MAJOR 3) set(PIP_MINOR 19) -set(PIP_REVISION 0) +set(PIP_REVISION 1) set(PIP_SUFFIX ) set(PIP_COMPANY SHS) set(PIP_DOMAIN org.SHS) diff --git a/libs/main/text/pistring.cpp b/libs/main/text/pistring.cpp index af33c8b5..2baace77 100644 --- a/libs/main/text/pistring.cpp +++ b/libs/main/text/pistring.cpp @@ -300,6 +300,7 @@ void PIString::appendFromChars(const char * c, int s, const char * codepage) { if (s == 0) return; int old_sz = size_s(); if (s == -1) s = strlen(c); + if (s <= 0) return; #ifdef PIP_ICU UErrorCode e((UErrorCode)0); UConverter * cc = ucnv_open(codepage, &e);