From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2124) id 87FC93858D37; Fri, 5 Aug 2022 09:30:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 87FC93858D37 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Nick Clifton To: bfd-cvs@sourceware.org Subject: [binutils-gdb] When gas/read.c calls mbstowcs with a NULL destination, it should set size to 0 X-Act-Checkin: binutils-gdb X-Git-Author: Nick Clifton X-Git-Refname: refs/heads/master X-Git-Oldrev: 731d2cc1d5106c077584bd83e96dbba4f7e11118 X-Git-Newrev: 5858ac626e548772407c038b09b7837550b127dd Message-Id: <20220805093023.87FC93858D37@sourceware.org> Date: Fri, 5 Aug 2022 09:30:23 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2022 09:30:23 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D5858ac626e54= 8772407c038b09b7837550b127dd commit 5858ac626e548772407c038b09b7837550b127dd Author: Nick Clifton Date: Fri Aug 5 10:29:48 2022 +0100 When gas/read.c calls mbstowcs with a NULL destination, it should set s= ize to 0 =20 PR 29447 * read.c (read_symbol_name): Pass 0 as the length parameter when invoking mbstowc in order to check the validity of a wide strin= g. Diff: --- gas/ChangeLog | 6 ++++++ gas/read.c | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 5a391a22636..f6b357709b2 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2022-08-05 Nick Clifton + + PR 29447 + * read.c (read_symbol_name): Pass 0 as the length parameter when + invoking mbstowc in order to check the validity of a wide string. + 2022-07-18 Claudiu Zissulescu =20 * config/tc-arc.c (md_assembly): Update strspn string with the diff --git a/gas/read.c b/gas/read.c index 800712466be..e23be666dde 100644 --- a/gas/read.c +++ b/gas/read.c @@ -1629,7 +1629,10 @@ read_symbol_name (void) /* Since quoted symbol names can contain non-ASCII characters, check the string and warn if it cannot be recognised by the current character set. */ - if (mbstowcs (NULL, name, len) =3D=3D (size_t) -1) + /* PR 29447: mbstowcs ignores the third (length) parameter when + the first (destination) parameter is NULL. For clarity sake + therefore we pass 0 rather than 'len' as the third parameter. */ + if (mbstowcs (NULL, name, 0) =3D=3D (size_t) -1) as_warn (_("symbol name not recognised in the current locale")); } else if (is_name_beginner (c) || (input_from_string && c =3D=3D FAKE_LAB= EL_CHAR))