<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - [ASan RTL] buggy indent of the shadow byte display"
href="http://llvm.org/bugs/show_bug.cgi?id=17061">17061</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[ASan RTL] buggy indent of the shadow byte display
</td>
</tr>
<tr>
<th>Product</th>
<td>compiler-rt
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>compiler-rt
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>chandlerc@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>