Lines Matching refs:size

41 int vsnprintf(char* const __pass_object_size dest, size_t size, const char* format, va_list ap)
43 return __builtin___vsnprintf_chk(dest, size, 0, __bos(dest), format, ap);
59 int snprintf(char* dest, size_t size, const char* format)
67 int snprintf(char* const __pass_object_size dest, size_t size, const char* format, ...)
71 int result = __builtin___vsnprintf_chk(dest, size, 0, __bos(dest), format, va);
96 size_t fread(void* const __pass_object_size0 buf, size_t size, size_t count, FILE* stream)
98 __clang_error_if(__unsafe_check_mul_overflow(size, count),
99 "in call to 'fread', size * count overflows")
100 __clang_error_if(__bos(buf) != __BIONIC_FORTIFY_UNKNOWN_SIZE && size * count > __bos(buf),
101 "in call to 'fread', size * count is too large for the given buffer") {
105 return __call_bypassing_fortify(fread)(buf, size, count, stream);
107 return __fread_chk(buf, size, count, stream, bos);
111 size_t fwrite(const void* const __pass_object_size0 buf, size_t size, size_t count, FILE* stream)
113 __clang_error_if(__unsafe_check_mul_overflow(size, count),
114 "in call to 'fwrite', size * count overflows")
115 __clang_error_if(__bos(buf) != __BIONIC_FORTIFY_UNKNOWN_SIZE && size * count > __bos(buf),
116 "in call to 'fwrite', size * count is too large for the given buffer") {
120 return __call_bypassing_fortify(fwrite)(buf, size, count, stream);
123 return __fwrite_chk(buf, size, count, stream, bos);
129 char* fgets(char* const __pass_object_size dest, int size, FILE* stream)
131 __clang_error_if(size < 0, "in call to 'fgets', size should not be negative")
132 __clang_error_if(size > __bos(dest),
133 "in call to 'fgets', size is larger than the destination buffer") {
137 return __call_bypassing_fortify(fgets)(dest, size, stream);
140 return __fgets_chk(dest, size, stream, bos);
147 __errordecl(__fread_too_big_error, "fread called with size * count bigger than buffer");
148 __errordecl(__fread_overflow, "fread called with overflowing size * count");
151 __errordecl(__fgets_too_big_error, "fgets called with size bigger than buffer");
152 __errordecl(__fgets_too_small_error, "fgets called with size less than zero");
155 __errordecl(__fwrite_too_big_error, "fwrite called with size * count bigger than buffer");
156 __errordecl(__fwrite_overflow, "fwrite called with overflowing size * count");
161 int snprintf(char* dest, size_t size, const char* format, ...) {
162 return __builtin___snprintf_chk(dest, size, 0, __bos(dest), format, __builtin_va_arg_pack());
173 size_t fread(void* buf, size_t size, size_t count, FILE* stream) {
177 return __fread_real(buf, size, count, stream);
180 if (__builtin_constant_p(size) && __builtin_constant_p(count)) {
182 if (__size_mul_overflow(size, count, &total)) {
190 return __fread_real(buf, size, count, stream);
193 return __fread_chk(buf, size, count, stream, bos);
197 size_t fwrite(const void* buf, size_t size, size_t count, FILE* stream) {
201 return __fwrite_real(buf, size, count, stream);
204 if (__builtin_constant_p(size) && __builtin_constant_p(count)) {
206 if (__size_mul_overflow(size, count, &total)) {
214 return __fwrite_real(buf, size, count, stream);
217 return __fwrite_chk(buf, size, count, stream, bos);
223 char *fgets(char* dest, int size, FILE* stream) {
226 // Compiler can prove, at compile time, that the passed in size
228 if (__builtin_constant_p(size) && (size < 0)) {
232 // Compiler doesn't know destination size. Don't call __fgets_chk
234 return __fgets_real(dest, size, stream);
237 // Compiler can prove, at compile time, that the passed in size
238 // is always <= the actual object size. Don't call __fgets_chk
239 if (__builtin_constant_p(size) && (size <= (int) bos)) {
240 return __fgets_real(dest, size, stream);
243 // Compiler can prove, at compile time, that the passed in size
244 // is always > the actual object size. Force a compiler error.
245 if (__builtin_constant_p(size) && (size > (int) bos)) {
249 return __fgets_chk(dest, size, stream, bos);