re PR sanitizer/88289 (r266664 causes asan to fail on many/most tests on BE)
authorJakub Jelinek <jakub@redhat.com>
Sat, 1 Dec 2018 07:31:56 +0000 (08:31 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sat, 1 Dec 2018 07:31:56 +0000 (08:31 +0100)
PR sanitizer/88289
* asan.c (asan_redzone_buffer::flush_redzone_payload): Fix up
an off-by-one for BYTES_BIG_ENDIAN.

From-SVN: r266708

gcc/ChangeLog
gcc/asan.c

index b215a9c635776365520e94deaa42575ca419035f..c84d6fa5c25af93116258041809eb1a6f349a749 100644 (file)
@@ -1,5 +1,9 @@
 2018-12-01  Jakub Jelinek  <jakub@redhat.com>
 
+       PR sanitizer/88289
+       * asan.c (asan_redzone_buffer::flush_redzone_payload): Fix up
+       an off-by-one for BYTES_BIG_ENDIAN.
+
        PR target/54589
        * combine.c (find_split_point): For invalid memory address
        nonobj + obj + const, if reg + obj + const is valid addressing
index 5d1d1dec064d5261e9dc96c3e8a62c4732a67dd4..0530ddd00564964f09aa0eee9ed7441689e2aaff 100644 (file)
@@ -1326,7 +1326,7 @@ asan_redzone_buffer::flush_redzone_payload (void)
   for (unsigned i = 0; i < RZ_BUFFER_SIZE; i++)
     {
       unsigned char v
-       = m_shadow_bytes[BYTES_BIG_ENDIAN ? RZ_BUFFER_SIZE - i : i];
+       = m_shadow_bytes[BYTES_BIG_ENDIAN ? RZ_BUFFER_SIZE - i - 1 : i];
       val |= (unsigned HOST_WIDE_INT)v << (BITS_PER_UNIT * i);
       if (dump_file && (dump_flags & TDF_DETAILS))
        fprintf (dump_file, "%02x ", v);