public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix buffer overflow in the arm port (PR target/69187)
@ 2016-01-21  9:20 Jakub Jelinek
  2016-01-21  9:27 ` Kyrill Tkachov
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2016-01-21  9:20 UTC (permalink / raw)
  To: Kyrill Tkachov; +Cc: gcc-patches

Hi!

This is the same issue that has been fixed a while ago in the aarch64 port
as PR65624.  Bootstrapped/regtested on armv7hl-linux-gnueabi, ok for trunk?

2016-01-21   Stefan Sørensen  <stefan.sorensen@spectralink.com>
	     Jakub Jelinek  <jakub@redhat.com>

	PR target/69187
	PR target/65624
	* config/arm/arm-builtins.c (arm_expand_neon_builtin): Increase
	args array size by one to avoid buffer overflow.

	* gcc.target/arm/pr69187.c: New test.

--- gcc/config/arm/arm-builtins.c.jj	2016-01-15 20:37:31.000000000 +0100
+++ gcc/config/arm/arm-builtins.c	2016-01-20 09:04:40.121275057 +0100
@@ -2246,7 +2246,7 @@ arm_expand_neon_builtin (int fcode, tree
   neon_builtin_datum *d =
 		&neon_builtin_data[fcode - ARM_BUILTIN_NEON_PATTERN_START];
   enum insn_code icode = d->code;
-  builtin_arg args[SIMD_MAX_BUILTIN_ARGS];
+  builtin_arg args[SIMD_MAX_BUILTIN_ARGS + 1];
   int num_args = insn_data[d->code].n_operands;
   int is_void = 0;
   int k;
--- gcc/testsuite/gcc.target/arm/pr69187.c.jj	2016-01-20 09:02:53.832778539 +0100
+++ gcc/testsuite/gcc.target/arm/pr69187.c	2016-01-20 09:03:26.132321652 +0100
@@ -0,0 +1,19 @@
+/* PR target/69187 */
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_neon } */
+/* { dg-options "-O0" }  */
+/* { dg-add-options arm_neon }  */
+
+#include <arm_neon.h>
+
+int32x4_t
+foo (void)
+{
+  int32x4_t vector_int32x4;
+  int16x4_t vector3_int16x4;
+  int16x4_t vector4_int16x4;
+  static int32_t buffer_int32x4[32];
+
+  vector_int32x4 = vld1q_s32(buffer_int32x4);
+  return vqdmlsl_lane_s16(vector_int32x4, vector3_int16x4, vector4_int16x4, 0);
+}

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix buffer overflow in the arm port (PR target/69187)
  2016-01-21  9:20 [PATCH] Fix buffer overflow in the arm port (PR target/69187) Jakub Jelinek
@ 2016-01-21  9:27 ` Kyrill Tkachov
  0 siblings, 0 replies; 2+ messages in thread
From: Kyrill Tkachov @ 2016-01-21  9:27 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches


On 21/01/16 09:20, Jakub Jelinek wrote:
> Hi!
>
> This is the same issue that has been fixed a while ago in the aarch64 port
> as PR65624.  Bootstrapped/regtested on armv7hl-linux-gnueabi, ok for trunk?

Ok, thanks for taking care of this.
Kyrill

> 2016-01-21   Stefan Sørensen  <stefan.sorensen@spectralink.com>
> 	     Jakub Jelinek  <jakub@redhat.com>
>
> 	PR target/69187
> 	PR target/65624
> 	* config/arm/arm-builtins.c (arm_expand_neon_builtin): Increase
> 	args array size by one to avoid buffer overflow.
>
> 	* gcc.target/arm/pr69187.c: New test.
>
> --- gcc/config/arm/arm-builtins.c.jj	2016-01-15 20:37:31.000000000 +0100
> +++ gcc/config/arm/arm-builtins.c	2016-01-20 09:04:40.121275057 +0100
> @@ -2246,7 +2246,7 @@ arm_expand_neon_builtin (int fcode, tree
>     neon_builtin_datum *d =
>   		&neon_builtin_data[fcode - ARM_BUILTIN_NEON_PATTERN_START];
>     enum insn_code icode = d->code;
> -  builtin_arg args[SIMD_MAX_BUILTIN_ARGS];
> +  builtin_arg args[SIMD_MAX_BUILTIN_ARGS + 1];
>     int num_args = insn_data[d->code].n_operands;
>     int is_void = 0;
>     int k;
> --- gcc/testsuite/gcc.target/arm/pr69187.c.jj	2016-01-20 09:02:53.832778539 +0100
> +++ gcc/testsuite/gcc.target/arm/pr69187.c	2016-01-20 09:03:26.132321652 +0100
> @@ -0,0 +1,19 @@
> +/* PR target/69187 */
> +/* { dg-do compile } */
> +/* { dg-require-effective-target arm_neon } */
> +/* { dg-options "-O0" }  */
> +/* { dg-add-options arm_neon }  */
> +
> +#include <arm_neon.h>
> +
> +int32x4_t
> +foo (void)
> +{
> +  int32x4_t vector_int32x4;
> +  int16x4_t vector3_int16x4;
> +  int16x4_t vector4_int16x4;
> +  static int32_t buffer_int32x4[32];
> +
> +  vector_int32x4 = vld1q_s32(buffer_int32x4);
> +  return vqdmlsl_lane_s16(vector_int32x4, vector3_int16x4, vector4_int16x4, 0);
> +}
>
> 	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-21  9:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-21  9:20 [PATCH] Fix buffer overflow in the arm port (PR target/69187) Jakub Jelinek
2016-01-21  9:27 ` Kyrill Tkachov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).