[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/30193] ASCII command length checking corner cases not properly h
From: |
nickc at redhat dot com |
Subject: |
[Bug ld/30193] ASCII command length checking corner cases not properly handled |
Date: |
Fri, 03 Mar 2023 10:00:38 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=30193
Nick Clifton <nickc at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |nickc at redhat dot com
--- Comment #1 from Nick Clifton <nickc at redhat dot com> ---
(In reply to Pekka Seppänen from comment #0)
Hi Pekka,
> of the input string (that has been processed). As the checking currently
> uses `len >= size' it is not possible to output a string that is exactly the
> allocated size, e.g. `ASCII (5) "ascii"'.
This is deliberate. The ASCII directive always produces a zero-terminated
string. From the documentation:
If the string is too long, a warning is issued
and the string is truncated. The string will
still be zero-terminated in this case.
> Also, as lang_add_string() processes both ASCIZ and ASCII commands it is not
> possible to produce an empty output, e.g. `ASCII (0) ""'. This might be
> useful if the command would be used to produce variable padding.
I find that very unlikely. Why would the padding need to be in the form of
ascii characters ?
Cheers
Nick
PS, Thank you very much for creating a patch to fix the problem. It is not
often that we get a bug report with an accompanying fix. I am sorry if my
comments above seem harsh, it is just that I think that in this case, the
current behaviour is actually correct.
--
You are receiving this mail because:
You are on the CC list for the bug.