You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
347 lines
4.8 KiB
347 lines
4.8 KiB
9 years ago
|
/*
|
||
6 years ago
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
9 years ago
|
*
|
||
7 years ago
|
* This source code is licensed under the MIT license found in the
|
||
|
* LICENSE file in the root directory of this source tree.
|
||
9 years ago
|
*/
|
||
9 years ago
|
|
||
10 years ago
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
|
||
10 years ago
|
void crash_getc() {
|
||
9 years ago
|
FILE* f;
|
||
|
int i;
|
||
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
i = getc(f);
|
||
|
printf("i =%i\n", i);
|
||
|
fclose(f);
|
||
|
}
|
||
|
|
||
|
void nocrash_getc() {
|
||
|
FILE* f;
|
||
|
int i;
|
||
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
if (f) {
|
||
10 years ago
|
i = getc(f);
|
||
|
printf("i =%i\n", i);
|
||
10 years ago
|
fclose(f);
|
||
9 years ago
|
}
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void crash_fgetc() {
|
||
|
FILE* f;
|
||
|
int i;
|
||
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
i = fgetc(f);
|
||
|
printf("i =%i\n", i);
|
||
|
fclose(f);
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void nocrash_fgetc() {
|
||
|
FILE* f;
|
||
|
int i;
|
||
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
if (f) {
|
||
10 years ago
|
i = fgetc(f);
|
||
10 years ago
|
printf("i =%i\n", i);
|
||
|
fclose(f);
|
||
9 years ago
|
}
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void crash_ungetc() {
|
||
|
FILE* f;
|
||
10 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
10 years ago
|
|
||
9 years ago
|
int i = ungetc(10, f);
|
||
|
fclose(f);
|
||
|
}
|
||
9 years ago
|
|
||
9 years ago
|
void nocrash_ungetc() {
|
||
|
FILE* f;
|
||
9 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
if (f) {
|
||
|
int i = ungetc(10, f);
|
||
10 years ago
|
fclose(f);
|
||
9 years ago
|
}
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void crash_fputs() {
|
||
|
FILE* f;
|
||
9 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
fputs("blablabla", f);
|
||
|
fclose(f);
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void nocrash_fputs() {
|
||
|
FILE* f;
|
||
9 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
if (f) {
|
||
10 years ago
|
fputs("blablabla", f);
|
||
|
fclose(f);
|
||
9 years ago
|
}
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void crash_fputc() {
|
||
|
FILE* f;
|
||
9 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
fputc(42, f);
|
||
|
fclose(f);
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void nocrash_fputc() {
|
||
|
FILE* f;
|
||
9 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
if (f) {
|
||
10 years ago
|
fputc(42, f);
|
||
|
fclose(f);
|
||
9 years ago
|
}
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void crash_putc() {
|
||
|
FILE* f;
|
||
9 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
putc(42, f);
|
||
|
fclose(f);
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void nocrash_putc() {
|
||
|
FILE* f;
|
||
9 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
if (f) {
|
||
10 years ago
|
putc(42, f);
|
||
|
fclose(f);
|
||
9 years ago
|
}
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void crash_fseeks() {
|
||
|
FILE* f;
|
||
9 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
fseek(f, 7, SEEK_SET);
|
||
|
fclose(f);
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void nocrash_fseek() {
|
||
|
FILE* f;
|
||
9 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
if (f) {
|
||
|
fseek(f, 7, SEEK_SET);
|
||
10 years ago
|
fclose(f);
|
||
9 years ago
|
}
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void crash_ftell() {
|
||
|
FILE* f;
|
||
9 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
ftell(f);
|
||
|
fclose(f);
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void nocrash_ftell() {
|
||
|
FILE* f;
|
||
9 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
if (f) {
|
||
10 years ago
|
ftell(f);
|
||
|
fclose(f);
|
||
9 years ago
|
}
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void crash_fgets() {
|
||
|
FILE* f;
|
||
|
char str[60];
|
||
9 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
fgets(str, 60, f);
|
||
|
fclose(f);
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void nocrash_fgets() {
|
||
|
FILE* f;
|
||
|
char str[60];
|
||
9 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
if (f) {
|
||
|
fgets(str, 60, f);
|
||
10 years ago
|
fclose(f);
|
||
9 years ago
|
}
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void crash_rewind() {
|
||
|
FILE* f;
|
||
9 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
rewind(f);
|
||
|
fclose(f);
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void nocrash_rewind() {
|
||
|
FILE* f;
|
||
10 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
if (f) {
|
||
10 years ago
|
rewind(f);
|
||
|
fclose(f);
|
||
9 years ago
|
}
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void crash_fileno() {
|
||
|
FILE* f;
|
||
9 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
fileno(f);
|
||
|
fclose(f);
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void nocrash_fileno() {
|
||
|
FILE* f;
|
||
9 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
if (f) {
|
||
10 years ago
|
fileno(f);
|
||
|
fclose(f);
|
||
9 years ago
|
}
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void crash_clearerr() {
|
||
|
FILE* f;
|
||
9 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
clearerr(f);
|
||
|
fclose(f);
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void nocrash_clearerr() {
|
||
|
FILE* f;
|
||
10 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
if (f) {
|
||
10 years ago
|
clearerr(f);
|
||
|
fclose(f);
|
||
9 years ago
|
}
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void crash_ferror() {
|
||
|
FILE* f;
|
||
9 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
ferror(f);
|
||
|
fclose(f);
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void nocrash_ferror() {
|
||
|
FILE* f;
|
||
9 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
if (f) {
|
||
10 years ago
|
ferror(f);
|
||
|
fclose(f);
|
||
9 years ago
|
}
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void crash_feof() {
|
||
|
FILE* f;
|
||
9 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
feof(f);
|
||
|
fclose(f);
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void nocrash_feof() {
|
||
|
FILE* f;
|
||
9 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
if (f) {
|
||
10 years ago
|
feof(f);
|
||
|
fclose(f);
|
||
9 years ago
|
}
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void crash_fprintf() {
|
||
|
FILE* f;
|
||
9 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
fprintf(f, "blablabla\n");
|
||
|
fclose(f);
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void nocrash_fprintf() {
|
||
|
FILE* f;
|
||
10 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
if (f) {
|
||
|
fprintf(f, "blablabla\n");
|
||
10 years ago
|
fclose(f);
|
||
9 years ago
|
}
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void crash_vfprintf() {
|
||
|
FILE* f;
|
||
|
va_list arg;
|
||
9 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
vfprintf(f, "blablabla\n", arg);
|
||
|
fclose(f);
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void nocrash_vfprintf() {
|
||
|
FILE* f;
|
||
|
va_list arg;
|
||
9 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
if (f) {
|
||
|
vfprintf(f, "blablabla\n", arg);
|
||
10 years ago
|
fclose(f);
|
||
9 years ago
|
}
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void crash_fgetpos() {
|
||
|
FILE* f;
|
||
|
fpos_t position;
|
||
9 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
fgetpos(f, &position);
|
||
|
fclose(f);
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void nocrash_fgetpos() {
|
||
|
FILE* f;
|
||
|
fpos_t position;
|
||
10 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
if (f) {
|
||
|
fgetpos(f, &position);
|
||
10 years ago
|
fclose(f);
|
||
9 years ago
|
}
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void crash_fsetpos() {
|
||
|
FILE* f;
|
||
|
fpos_t position;
|
||
9 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
fsetpos(f, &position);
|
||
|
fclose(f);
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
void nocrash_fsetpos() {
|
||
|
FILE* f;
|
||
|
fpos_t position;
|
||
9 years ago
|
|
||
9 years ago
|
f = fopen("this_file_doesnt_exist", "r");
|
||
|
if (f) {
|
||
|
fsetpos(f, &position);
|
||
10 years ago
|
fclose(f);
|
||
9 years ago
|
}
|
||
10 years ago
|
}
|