Skip to content

Commit 67d9b6e

Browse files
committed
C library: add __stdio_common_ variants of vfscanf, vsscanf
MSVC headers eventually call these when using fscanf/sscanf.
1 parent 859bb15 commit 67d9b6e

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

src/ansi-c/library/stdio.c

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,52 @@ __CPROVER_HIDE:;
10351035
return result;
10361036
}
10371037

1038+
/* FUNCTION: __stdio_common_vfscanf */
1039+
1040+
#ifdef _WIN32
1041+
1042+
# ifndef __CPROVER_STDIO_H_INCLUDED
1043+
# include <stdio.h>
1044+
# define __CPROVER_STDIO_H_INCLUDED
1045+
# endif
1046+
1047+
# ifndef __CPROVER_STDARG_H_INCLUDED
1048+
# include <stdarg.h>
1049+
# define __CPROVER_STDARG_H_INCLUDED
1050+
# endif
1051+
1052+
int __VERIFIER_nondet_int();
1053+
1054+
int __stdio_common_vfscanf(
1055+
unsigned __int64 options,
1056+
FILE *stream,
1057+
char const *format,
1058+
_locale_t locale,
1059+
va_list args)
1060+
{
1061+
(void)options;
1062+
(void)locale;
1063+
1064+
int result = __VERIFIER_nondet_int();
1065+
1066+
if(stream != stdin)
1067+
{
1068+
(void)*(char *)stream;
1069+
}
1070+
1071+
(void)*format;
1072+
(void)args;
1073+
1074+
# ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS
1075+
__CPROVER_assert(
1076+
__CPROVER_get_must(stream, "open"), "vfscanf file must be open");
1077+
# endif
1078+
1079+
return result;
1080+
}
1081+
1082+
#endif
1083+
10381084
/* FUNCTION: vscanf */
10391085

10401086
#ifndef __CPROVER_STDIO_H_INCLUDED
@@ -1122,6 +1168,44 @@ __CPROVER_HIDE:;
11221168
return result;
11231169
}
11241170

1171+
/* FUNCTION: __stdio_common_vsscanf */
1172+
1173+
#ifdef _WIN32
1174+
1175+
# ifndef __CPROVER_STDIO_H_INCLUDED
1176+
# include <stdio.h>
1177+
# define __CPROVER_STDIO_H_INCLUDED
1178+
# endif
1179+
1180+
# ifndef __CPROVER_STDARG_H_INCLUDED
1181+
# include <stdarg.h>
1182+
# define __CPROVER_STDARG_H_INCLUDED
1183+
# endif
1184+
1185+
int __VERIFIER_nondet_int();
1186+
1187+
int __stdio_common_vsscanf(
1188+
unsigned __int64 options,
1189+
char const *s,
1190+
size_t buffer_count,
1191+
char const *format,
1192+
_locale_t locale,
1193+
va_list args)
1194+
{
1195+
(void)options;
1196+
(void)locale;
1197+
1198+
int result = __VERIFIER_nondet_int();
1199+
1200+
(void)*s;
1201+
(void)*format;
1202+
(void)args;
1203+
1204+
return result;
1205+
}
1206+
1207+
#endif
1208+
11251209
/* FUNCTION: printf */
11261210

11271211
#ifndef __CPROVER_STDIO_H_INCLUDED

0 commit comments

Comments
 (0)