Skip to content

Instantly share code, notes, and snippets.

@ennorehling
Created June 9, 2015 05:51
Show Gist options
  • Save ennorehling/196cdf1635b88c1c72ac to your computer and use it in GitHub Desktop.
Save ennorehling/196cdf1635b88c1c72ac to your computer and use it in GitHub Desktop.
This program makes valgrind complain about an invalid read in strtod
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <gnu/libc-version.h>
int main(void) {
char *endp;
char *str = strdup("id");
double ld;
puts (gnu_get_libc_version ());
ld = strtod(str, &endp);
free(str);
return ld==0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment