[llvm-bugs] [Bug 35137] New: ASan strotol interceptor breaks errno on Windows
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Oct 30 14:36:35 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=35137
Bug ID: 35137
Summary: ASan strotol interceptor breaks errno on Windows
Product: compiler-rt
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: compiler-rt
Assignee: unassignedbugs at nondot.org
Reporter: rnk at google.com
CC: llvm-bugs at lists.llvm.org
Running this program on Windows prints "errno: 34" without asan and "errno: 0"
with asan:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
void print_strtol_results(const char *input) {
char *end = 0;
long result = strtol(input, &end, 10);
int err = errno;
printf("input: %s, end: %s, result: %ld, errno: %d\n", input, end, result,
err);
}
int main() {
//print_strtol_results("2147483647");
print_strtol_results("2147483648");
printf("&errno: %p, errno: %d\n", &errno, errno);
return 0;
}
This is because ASan intercepts many versions of strtol and redirects them all
to itself. It then delegates to ntdll!strtol, which doesn't set errno, because
errno is a CRT concept, and ntdll is layered below the CRT.
--
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/20171030/1b37190a/attachment.html>
More information about the llvm-bugs
mailing list