All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Cercueil <paul@crapouillou.net>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 05/11] dialog: Patch incorrect use of toupper()
Date: Tue, 08 Apr 2014 18:56:12 +0200	[thread overview]
Message-ID: <53442A2C.4080206@crapouillou.net> (raw)
In-Reply-To: <533E5510.6040800@mind.be>

Hi,

On 04/04/2014 08:45, Arnout Vandecappelle wrote:
> On 03/04/14 23:32, Yann E. MORIN wrote:
>> Paul, All,
>>
>> On 2014-04-03 23:01 +0200, Paul Cercueil spake thusly:
>>> On some platforms (e.g. MIPS), the "char" type is signed by default.
>>> The problem is that toupper() takes an int as argument: a signed
>>> char then gets sign-extended to 32bit, which causes an assertion
>>> failure as toupper() verifies that its argument fits in 8 bits.
>> I could not vefrify the assertion that MIPS has signed chars.
>   I think char is signed on all platforms. At least, it is on all
> platforms I regularly use.
>

Well I read that ARM has unsigned chars, but I can't seem to find a real 
list.

>> However, this change is still corect, since it makes it explicit that we
>> want an unsigned char.
>   But then we should change all the packages that use toupper and
> tolower... (and also isdigit and isalnum and ...).
>
>   Basically, if toupper() asserts in this case, it's a bug in the
> toolchain, not in the package.

So you suggest to patch uClibc instead?

>
>
>   Regards,
>   Arnout
>
>>> Signed-Off-By: Paul Cercueil <paul@crapouillou.net>
>>> Acked-By: Maarten ter Huurne <maarten@treewalker.org>
>> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
>>
>> Regards,
>> Yann E. MORIN.
>>
>>> ---
>>>   package/dialog/dialog-toupper.patch | 13 +++++++++++++
>>>   1 file changed, 13 insertions(+)
>>>   create mode 100644 package/dialog/dialog-toupper.patch
>>>
>>> diff --git a/package/dialog/dialog-toupper.patch b/package/dialog/dialog-toupper.patch
>>> new file mode 100644
>>> index 0000000..3fe0e19
>>> --- /dev/null
>>> +++ b/package/dialog/dialog-toupper.patch
>>> @@ -0,0 +1,13 @@
>>> +diff --git a/dlg_keys.h b/dlg_keys.h
>>> +index 6a96c0f..b7b42d9 100644
>>> +--- a/dlg_keys.h
>>> ++++ b/dlg_keys.h
>>> +@@ -31,7 +31,7 @@
>>> + #define dlg_toupper(ch) towupper((wint_t)ch)
>>> + #define dlg_isupper(ch) iswupper((wint_t)ch)
>>> + #else
>>> +-#define dlg_toupper(ch) toupper(ch)
>>> ++#define dlg_toupper(ch) toupper((unsigned char)(ch))
>>> + #define dlg_isupper(ch) (isalpha(ch) && isupper(ch))
>>> + #endif
>>> +
>>> -- 
>>> 1.9.0
>>>
>>> _______________________________________________
>>> buildroot mailing list
>>> buildroot at busybox.net
>>> http://lists.busybox.net/mailman/listinfo/buildroot
>

  reply	other threads:[~2014-04-08 16:56 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-03 21:01 [Buildroot] [PATCH 01/11] toolchain: Make vendor configurable Paul Cercueil
2014-04-03 21:01 ` [Buildroot] [PATCH 02/11] arch: MIPS: Add config option BR2_GCC_TARGET_TUNE Paul Cercueil
2014-04-03 21:19   ` Yann E. MORIN
2014-04-03 21:50     ` Paul Cercueil
2014-04-03 22:12       ` Yann E. MORIN
2014-04-05 15:53         ` Paul Cercueil
2014-04-05 16:47           ` Yann E. MORIN
2014-04-07 13:53       ` Markos Chandras
2014-04-03 21:01 ` [Buildroot] [PATCH 03/11] gdb: Patch for "unrecognized real-time signal" bug Paul Cercueil
2014-10-12 14:06   ` Vincent Olivert Riera
2014-10-12 15:57   ` Thomas Petazzoni
2014-04-03 21:01 ` [Buildroot] [PATCH 04/11] gdb: Fix on-target threads debugging Paul Cercueil
2014-04-03 21:23   ` Yann E. MORIN
2014-04-03 21:01 ` [Buildroot] [PATCH 05/11] dialog: Patch incorrect use of toupper() Paul Cercueil
2014-04-03 21:32   ` Yann E. MORIN
2014-04-04  6:45     ` Arnout Vandecappelle
2014-04-08 16:56       ` Paul Cercueil [this message]
2014-04-10  8:40       ` Thomas De Schampheleire
2014-04-10  9:44         ` Arnout Vandecappelle
2014-07-19 14:06           ` Thomas De Schampheleire
2014-08-15 23:00   ` Paul Cercueil
2014-04-03 21:01 ` [Buildroot] [PATCH 06/11] libao: Remove OSS plugin when ALSA is enabled Paul Cercueil
2014-04-03 21:37   ` Yann E. MORIN
2014-04-03 21:01 ` [Buildroot] [PATCH 07/11] fmtools: Switch to 2.x series Paul Cercueil
2014-04-03 21:45   ` Yann E. MORIN
2014-04-06 13:26   ` Thomas Petazzoni
2014-04-03 21:01 ` [Buildroot] [PATCH 08/11] python-pygame: Make installation of examples optional Paul Cercueil
2014-04-03 21:48   ` Yann E. MORIN
2014-04-04  6:14     ` Arnout Vandecappelle
2014-04-03 21:01 ` [Buildroot] [PATCH 09/11] util-linux: Add config switches for some more binaries Paul Cercueil
2014-04-03 21:55   ` Yann E. MORIN
2014-04-03 22:00     ` Paul Cercueil
2014-04-03 21:01 ` [Buildroot] [PATCH 10/11] luajit: Allow to build on Mips and Mipsel platforms Paul Cercueil
2014-04-04 21:41   ` Thomas Petazzoni
2014-04-03 21:01 ` [Buildroot] [PATCH 11/11] stress: Patch to fix documentation source Paul Cercueil
2014-04-03 21:12 ` [Buildroot] [PATCH 01/11] toolchain: Make vendor configurable Yann E. MORIN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53442A2C.4080206@crapouillou.net \
    --to=paul@crapouillou.net \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.