7 #ifdef __CPROVER_STRING_ABSTRACTION
12 "strcpy buffer overflow");
15 "builtin object size");
22 "strcpy src/dst overlap");
23 __CPROVER_size_t i = 0;
30 }
while(i < s && ch != (
char)0);
41 #ifdef __CPROVER_STRING_ABSTRACTION
42 __CPROVER_size_t new_size;
49 "builtin object size");
63 "strcat src/dst overlap");
64 __CPROVER_size_t i = 0;
68 __CPROVER_size_t j = 0;
70 for(; i < s && ch != (char)0; ++i, ++j)
82 char *dst,
const char *src, __CPROVER_size_t n, __CPROVER_size_t s)
85 #ifdef __CPROVER_STRING_ABSTRACTION
86 __CPROVER_size_t additional, new_size;
91 "strncat zero-termination of 2nd argument");
94 "builtin object size");
104 dst[dest_len + i] = src[i];
105 dst[dest_len + i] = 0;
111 "strncat src/dst overlap");
113 __CPROVER_size_t i = 0;
117 __CPROVER_size_t j = 0;
119 for(; i < s && j < n && ch != (char)0; ++i, ++j)
132 #ifndef __CPROVER_STRING_H_INCLUDED
134 #define __CPROVER_STRING_H_INCLUDED
142 #ifdef __CPROVER_STRING_ABSTRACTION
147 "strcpy buffer overflow");
154 "strcpy src/dst overlap");
155 __CPROVER_size_t i = 0;
162 }
while(ch != (
char)0);
169 #ifndef __CPROVER_STRING_H_INCLUDED
171 #define __CPROVER_STRING_H_INCLUDED
176 char *
strncpy(
char *dst,
const char *src,
size_t n)
179 #ifdef __CPROVER_STRING_ABSTRACTION
189 (src >= dst + n) || (dst >= src + n),
190 "strncpy src/dst overlap");
191 __CPROVER_size_t i = 0;
197 for(end = 0; i < n; i++)
199 ch = end ? 0 : src[i];
201 end = end || ch == (char)0;
209 #ifndef __CPROVER_STRING_H_INCLUDED
211 #define __CPROVER_STRING_H_INCLUDED
221 #ifdef __CPROVER_STRING_ABSTRACTION
228 "strncpy object size");
234 (src >= dst + n) || (dst >= src + n),
235 "strncpy src/dst overlap");
236 __CPROVER_size_t i = 0;
243 for(end = 0; i < n; i++)
245 ch = end ? 0 : src[i];
247 end = end || ch == (char)0;
255 #ifndef __CPROVER_STRING_H_INCLUDED
257 #define __CPROVER_STRING_H_INCLUDED
265 #ifdef __CPROVER_STRING_ABSTRACTION
266 __CPROVER_size_t new_size;
268 "strcat zero-termination of 1st argument");
270 "strcat zero-termination of 2nd argument");
273 "strcat buffer overflow");
283 "strcat src/dst overlap");
284 __CPROVER_size_t i = 0;
288 __CPROVER_size_t j = 0;
290 for(; ch != (char)0; ++i, ++j)
301 #ifndef __CPROVER_STRING_H_INCLUDED
303 #define __CPROVER_STRING_H_INCLUDED
308 char *
strncat(
char *dst,
const char *src,
size_t n)
311 #ifdef __CPROVER_STRING_ABSTRACTION
312 __CPROVER_size_t additional, new_size;
317 "strncat zero-termination of 2nd argument");
327 dst[dest_len + i] = src[i];
328 dst[dest_len + i] = 0;
334 (src >= dst + n) || (dst >= src + n),
335 "strncat src/dst overlap");
337 __CPROVER_size_t i = 0;
341 __CPROVER_size_t j = 0;
343 for(; j < n && ch != (char)0; ++i, ++j)
356 #ifndef __CPROVER_STRING_H_INCLUDED
358 #define __CPROVER_STRING_H_INCLUDED
366 #ifdef __CPROVER_STRING_ABSTRACTION
369 "strcmp zero-termination of 1st argument");
371 "strcmp zero-termination of 2nd argument");
378 __CPROVER_size_t i=0;
379 unsigned char ch1, ch2;
382 # pragma CPROVER check push
383 # pragma CPROVER check disable "conversion"
386 # pragma CPROVER check pop
398 while(ch1!=0 && ch2!=0);
405 #ifndef __CPROVER_STRING_H_INCLUDED
407 #define __CPROVER_STRING_H_INCLUDED
415 #ifdef __CPROVER_STRING_ABSTRACTION
418 "strcasecmp zero-termination of 1st argument");
420 "strcasecmp zero-termination of 2nd argument");
427 __CPROVER_size_t i=0;
428 unsigned char ch1, ch2;
431 # pragma CPROVER check push
432 # pragma CPROVER check disable "conversion"
435 # pragma CPROVER check pop
437 if(ch1>=
'A' && ch1<=
'Z') ch1+=(
'a'-
'A');
438 if(ch2>=
'A' && ch2<=
'Z') ch2+=(
'a'-
'A');
450 while(ch1!=0 && ch2!=0);
457 #ifndef __CPROVER_STRING_H_INCLUDED
459 #define __CPROVER_STRING_H_INCLUDED
467 #ifdef __CPROVER_STRING_ABSTRACTION
470 "strncmp zero-termination of 1st argument");
473 "strncmp zero-termination of 2nd argument");
475 __CPROVER_size_t i=0;
476 unsigned char ch1, ch2;
481 # pragma CPROVER check push
482 # pragma CPROVER check disable "conversion"
485 # pragma CPROVER check pop
497 while(ch1!=0 && ch2!=0 && i<n);
504 #ifndef __CPROVER_STRING_H_INCLUDED
506 #define __CPROVER_STRING_H_INCLUDED
514 #ifdef __CPROVER_STRING_ABSTRACTION
517 "strncasecmp zero-termination of 1st argument");
519 "strncasecmp zero-termination of 2nd argument");
522 __CPROVER_size_t i=0;
523 unsigned char ch1, ch2;
528 # pragma CPROVER check push
529 # pragma CPROVER check disable "conversion"
532 # pragma CPROVER check pop
534 if(ch1>=
'A' && ch1<=
'Z') ch1+=(
'a'-
'A');
535 if(ch2>=
'A' && ch2<=
'Z') ch2+=(
'a'-
'A');
547 while(ch1!=0 && ch2!=0 && i<n);
554 #ifndef __CPROVER_STRING_H_INCLUDED
556 #define __CPROVER_STRING_H_INCLUDED
564 #ifdef __CPROVER_STRING_ABSTRACTION
566 "strlen zero-termination");
569 __CPROVER_size_t len=0;
570 while(s[len]!=0) len++;
577 #ifndef __CPROVER_STRING_H_INCLUDED
579 #define __CPROVER_STRING_H_INCLUDED
582 #ifndef __CPROVER_STDLIB_H_INCLUDED
584 #define __CPROVER_STDLIB_H_INCLUDED
593 __CPROVER_size_t bufsz;
595 char *cpy = (
char *)
calloc(bufsz *
sizeof(
char),
sizeof(char));
596 if(cpy==((
void *)0))
return 0;
597 #ifdef __CPROVER_STRING_ABSTRACTION
606 #ifndef __CPROVER_STRING_H_INCLUDED
608 #define __CPROVER_STRING_H_INCLUDED
613 void *
memcpy(
void *dst,
const void *src,
size_t n)
617 #ifdef __CPROVER_STRING_ABSTRACTION
637 ((
const char *)src >= (
const char *)dst + n) ||
638 ((
const char *)dst >= (
const char *)src + n),
639 "memcpy src/dst overlap");
662 #ifdef __CPROVER_STRING_ABSTRACTION
669 "builtin object size");
684 ((
const char *)src >= (
const char *)dst + n) ||
685 ((
const char *)dst >= (
const char *)src + n),
686 "memcpy src/dst overlap");
706 #ifndef __CPROVER_STRING_H_INCLUDED
708 #define __CPROVER_STRING_H_INCLUDED
716 #ifdef __CPROVER_STRING_ABSTRACTION
718 "memset buffer overflow");
734 "memset destination region writeable");
740 unsigned char s_n[n];
753 #ifdef __CPROVER_STRING_ABSTRACTION
755 "memset buffer overflow");
773 "memset destination region writeable");
779 unsigned char s_n[n];
792 #ifdef __CPROVER_STRING_ABSTRACTION
794 "memset buffer overflow");
797 "builtin object size");
813 "memset destination region writeable");
820 unsigned char s_n[n];
830 #ifndef __CPROVER_STRING_H_INCLUDED
832 #define __CPROVER_STRING_H_INCLUDED
837 void *
memmove(
void *dest,
const void *src,
size_t n)
840 #ifdef __CPROVER_STRING_ABSTRACTION
842 "memmove buffer overflow");
854 "memmove source region readable");
856 "memmove destination region writeable");
870 #ifndef __CPROVER_STRING_H_INCLUDED
872 #define __CPROVER_STRING_H_INCLUDED
880 #ifdef __CPROVER_STRING_ABSTRACTION
882 "memmove buffer overflow");
885 "builtin object size");
899 "memmove source region readable");
901 "memmove destination region writeable");
916 #ifndef __CPROVER_STRING_H_INCLUDED
918 #define __CPROVER_STRING_H_INCLUDED
927 #ifdef __CPROVER_STRING_ABSTRACTION
929 "memcmp buffer overflow of 1st argument");
931 "memcmp buffer overflow of 2nd argument");
934 "memcmp region 1 readable");
936 "memcpy region 2 readable");
938 const unsigned char *sc1=
s1, *sc2=
s2;
941 res = (*sc1++) - (*sc2++);
951 #ifndef __CPROVER_STRING_H_INCLUDED
953 #define __CPROVER_STRING_H_INCLUDED
961 #ifdef __CPROVER_STRING_ABSTRACTION
963 "strchr zero-termination of string argument");
964 __CPROVER_bool found;
966 return found?src+i:0;
968 for(__CPROVER_size_t i=0; ; i++)
971 return ((
char *)src)+i;
980 #ifndef __CPROVER_STRING_H_INCLUDED
982 #define __CPROVER_STRING_H_INCLUDED
990 #ifdef __CPROVER_STRING_ABSTRACTION
992 "strrchr zero-termination of string argument");
993 __CPROVER_bool found;
995 return found?((
char *)src)+i:0;
998 for(__CPROVER_size_t i=0; ; i++)
1000 if(src[i]==(
char)c) res=((
char *)src)+i;
1001 if(src[i]==0)
break;
1009 #ifndef __CPROVER_STRING_H_INCLUDED
1011 #define __CPROVER_STRING_H_INCLUDED
1018 #ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS
1019 __CPROVER_event(
"invalidate_pointer",
"strerror_result");
1020 char *strerror_result;
1022 return strerror_result;
1024 static char strerror_result[1];
1025 return strerror_result;
__CPROVER_bool __CPROVER_w_ok(const void *,...)
__CPROVER_bool __CPROVER_r_ok(const void *,...)
exprt object_size(const exprt &pointer)
void * calloc(__CPROVER_size_t nmemb, __CPROVER_size_t size)
int strncmp(const char *s1, const char *s2, size_t n)
int strcmp(const char *s1, const char *s2)
void * memcpy(void *dst, const void *src, size_t n)
char * strcpy(char *dst, const char *src)
void * __builtin_memset(void *s, int c, __CPROVER_size_t n)
char * strdup(const char *str)
char * __builtin___strcpy_chk(char *dst, const char *src, __CPROVER_size_t s)
char * strchr(const char *src, int c)
char * strcat(char *dst, const char *src)
char * strrchr(const char *src, int c)
void * __builtin___memmove_chk(void *dest, const void *src, size_t n, __CPROVER_size_t size)
char * strncat(char *dst, const char *src, size_t n)
void * __builtin___memcpy_chk(void *dst, const void *src, __CPROVER_size_t n, __CPROVER_size_t size)
int strncasecmp(const char *s1, const char *s2, size_t n)
int strcasecmp(const char *s1, const char *s2)
void * memmove(void *dest, const void *src, size_t n)
char * __builtin___strncpy_chk(char *dst, const char *src, size_t n, size_t object_size)
int memcmp(const void *s1, const void *s2, size_t n)
size_t strlen(const char *s)
void * __builtin___memset_chk(void *s, int c, __CPROVER_size_t n, __CPROVER_size_t size)
__inline char * __builtin___strncat_chk(char *dst, const char *src, __CPROVER_size_t n, __CPROVER_size_t s)
void * memset(void *s, int c, size_t n)
__inline char * __builtin___strcat_chk(char *dst, const char *src, __CPROVER_size_t s)
char * strncpy(char *dst, const char *src, size_t n)
char * strerror(int errnum)