-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillacompiler-rt:asanAddress sanitizerAddress sanitizerplatform:windows
Description
| Bugzilla Link | 35137 |
| Version | unspecified |
| OS | Windows NT |
| CC | @markmentovai,@Predelnik,@vitalybuka |
Extended Description
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.
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillacompiler-rt:asanAddress sanitizerAddress sanitizerplatform:windows