[LLVMbugs] [Bug 17061] New: [ASan RTL] buggy indent of the shadow byte display

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Sep 2 14:20:19 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=17061

            Bug ID: 17061
           Summary: [ASan RTL] buggy indent of the shadow byte display
           Product: compiler-rt
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: compiler-rt
          Assignee: unassignedbugs at nondot.org
          Reporter: chandlerc at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Simple buggy program:
#include <iostream>

static const char hello[] = "Hello";
static const char world[] = "World";

void copy_hello(char *output) {
  for (auto c : hello)
    *output++ = c;
}

void copy_world(char *output) {
  for (auto c : world)
    *output++ = c;
}

int main() {
  // Buffer of 11 characters for "Hello", "World" and the space in between.
  char *buffer = new char[10 + 1];

  copy_hello(buffer);
  buffer[5] = ' ';
  copy_world(buffer + 6);

  std::cout << std::string(buffer) << std::endl;

  delete[] buffer;
}


Shows the output with ASan:
% ./asan_bug                                                     
=================================================================
==31726==ERROR: AddressSanitizer: heap-buffer-overflow on address
0x60200000effb at pc 0x43fed8 bp 0x7fff37249350 sp 0x7fff37249348
WRITE of size 1 at 0x60200000effb thread T0
    #0 0x43fed7 in copy_world(char*)
/home/chandlerc/src/llvm.git/build/gn_2013/asan/bug.cpp:13
    #1 0x44021d in main
/home/chandlerc/src/llvm.git/build/gn_2013/asan/bug.cpp:22
    #2 0x2aaaab60c60c (/lib64/libc.so.6+0x2460c)
    #3 0x43f658 in _start
(/home/chandlerc/src/llvm.git/build/gn_2013/asan_bug+0x43f658)
0x60200000effb is located 0 bytes to the right of 11-byte region
[0x60200000eff0,0x60200000effb)
allocated by thread T0 here:
    #0 0x42c484 in operator new[](unsigned long)
/home/chandlerc/src/llvm.git/build/../projects/compiler-rt/lib/asan/asan_new_delete.cc:54
    #1 0x44013b in main
/home/chandlerc/src/llvm.git/build/gn_2013/asan/bug.cpp:18
    #2 0x2aaaab60c60c (/lib64/libc.so.6+0x2460c)
SUMMARY: AddressSanitizer: heap-buffer-overflow
/home/chandlerc/src/llvm.git/build/gn_2013/asan/bug.cpp:13 copy_world(char*)
Shadow bytes around the buggy address:
  0x0c047fff9da0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9db0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9dc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9dd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9de0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c047fff9df0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa 00[03]
  0x0c047fff9e00:fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa

                 ^^
Why is this not indented?

The rest of the lines are.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130902/1b4b753b/attachment.html>


More information about the llvm-bugs mailing list