Re: [PATCH] Prevent out of bound access for multilib_options

2014-04-15 Thread Kito Cheng
Hi Jakub: Thanks your review and approve, however I don't have commit right yet, can you help me to commit it :) And here is updated patch in attachment, thanks! On Mon, Apr 14, 2014 at 8:12 PM, Jakub Jelinek wrote: > On Wed, Apr 09, 2014 at 10:00:38PM +0800, Kito Cheng wrote: >> `q` will out o

Re: [PATCH] Prevent out of bound access for multilib_options

2014-04-14 Thread Jakub Jelinek
On Wed, Apr 09, 2014 at 10:00:38PM +0800, Kito Cheng wrote: > `q` will out of bound access if `*q` already reach the end of > multilib_options, so check it before increment to prevent condition > check part out of bound access. > > btw, this bug is detected by address sanitizer. > > > 2014-04-09

Re: [PATCH] Prevent out of bound access for multilib_options

2014-04-09 Thread Graham Stott
All, It happens with all mulitilib configurations not just arm-elf if we have reached the end of the multilib_options string there are no more options to processĀ  so break from the loop. This patch is an alternative fix. = Index: gcc.c ===

Re: [PATCH] Prevent out of bound access for multilib_options

2014-04-09 Thread Kito Cheng
More detail for arm-elf-eabi :) After first iteration at gcc.c:7493-7534, r = q = "mfloat-abi=hard" at gcc.c:7498 then continue scan multilib_options at gcc.c:7499-7507, and then `q` already reach the end of `multilib_options` which mean `q` == multilib_options + strlen(multilib_options) so the `

Re: [PATCH] Prevent out of bound access for multilib_options

2014-04-09 Thread Kito Cheng
for example: arm-elf-eabi in trunk, multilib_options = "marm/mthumb mfloat-abi=hard" and it's my configure options: /home/kito/gcc/gcc-src/configure --prefix=/home/kito/gcc-workspace/arm-eabi --target=arm-elf-eabi CFLAGS="-fsanitize=address -g" CXXFLAGS="-fsanitize=address -g" LDFLAGS="-fsanitize=

Re: [PATCH] Prevent out of bound access for multilib_options

2014-04-09 Thread Jakub Jelinek
On Wed, Apr 09, 2014 at 10:00:38PM +0800, Kito Cheng wrote: > `q` will out of bound access if `*q` already reach the end of > multilib_options, so check it before increment to prevent condition > check part out of bound access. > > btw, this bug is detected by address sanitizer. Can you please ex

[PATCH] Prevent out of bound access for multilib_options

2014-04-09 Thread Kito Cheng
`q` will out of bound access if `*q` already reach the end of multilib_options, so check it before increment to prevent condition check part out of bound access. btw, this bug is detected by address sanitizer. 2014-04-09 Kito Cheng * gcc.c (used_arg): Prevent out of bound access for multi