bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/29447] New: when gas/read.c calls mbstowcs with a NULL destinat


From: nicolas at debian dot org
Subject: [Bug gas/29447] New: when gas/read.c calls mbstowcs with a NULL destination, it should set size to 0
Date: Thu, 04 Aug 2022 08:27:35 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=29447

            Bug ID: 29447
           Summary: when gas/read.c calls mbstowcs with a NULL
                    destination, it should set size to 0
           Product: binutils
           Version: 2.39
            Status: NEW
          Severity: minor
          Priority: P2
         Component: gas
          Assignee: unassigned at sourceware dot org
          Reporter: nicolas at debian dot org
  Target Milestone: ---

Hello.

As described in bug 29265, glibc should not report an error when mbstowcs is
called with a NULL destination buffer and a non-zero size. Strictly speaking,
this alert is a false positive because the documentation for mbstowcs
explicitly mentions that the size argument is ignored when the buffer is NULL.  

However, in the specific case of binutils/gas/read.c:1670, a value of 0 would
be more readable.  The current version strongly suggests that the 'len'
variable is relevant.

--- src/gas/read.c
+++ src/gas/read.c
@@ -1667,7 +1667,7 @@
       /* 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) == (size_t) -1)
+      if (mbstowcs (NULL, name, 0) == (size_t) -1)
        as_warn (_("symbol name not recognised in the current locale"));
     }
   else if (is_name_beginner (c) || (input_from_string && c == FAKE_LABEL_CHAR)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]