about summary refs log tree commit diff
path: root/stdio-common/vfprintf.c
Commit message (Collapse)AuthorAgeFilesLines
* vfprintf: Remove label name switching for the jump tableFlorian Weimer2015-05-211-17/+4
| | | | | Different labels are no longer needed because the tables are now in separate functions.
* vfprintf: Introduce printf_positional functionFlorian Weimer2015-05-211-347/+369
| | | | | | This splits a considerable chunk of code from the main vfprintf function. This will make it easier to remove the use of extend_alloca from the positional argument handling code.
* vfprintf: Move jump table definition and the macros out of functionFlorian Weimer2015-05-211-65/+64
| | | | | The second jump table will be moved to a separate function in the next commit.
* vfprintf: Define WORK_BUFFER_SIZEFlorian Weimer2015-03-061-11/+11
| | | | | This constant will allow us to refer to the number of elements in work_buffer across a function call boundary.
* vfprintf: Introduce JUMP_TABLE_BASE_LABELFlorian Weimer2015-03-061-3/+6
| | | | | This makes the offset handling more explicit and avoids cross-references between the jump tables.
* vfprintf: Introduce THOUSANDS_SEP_TFlorian Weimer2015-03-061-18/+5
| | | | This avoids preprocessor conditionals in function declarations.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2015-01-021-1/+1
|
* CVE-2012-3406: Stack overflow in vfprintf [BZ #16617]Jeff Law2014-12-151-2/+38
| | | | | | A larger number of format specifiers coudld cause a stack overflow, potentially allowing to bypass _FORTIFY_SOURCE format string protection.
* Correctly handle %p in wprintf (BZ #16890)Andreas Schwab2014-05-011-1/+2
|
* Revert "Fix _IO_JUMPS_OFFSET -Wundef warnings"Will Newton2014-03-171-1/+1
| | | | This reverts commit f7efd7c3dfffa3c417e9d3c4cb19d9954a3b1421.
* Fix _IO_JUMPS_OFFSET -Wundef warningsWill Newton2014-03-171-1/+1
| | | | | | | | | | | | ChangeLog: 2014-03-17 Will Newton <will.newton@linaro.org> * libio/genops.c: Check whether _IO_JUMPS_OFFSET is defined with #ifdef rather than #if. * libio/libioP.h: Likewise. * stdio-common/vfprintf.c: Likewise.
* Fix integer overflow in vfwprintf. Fixes bug 14286.Ondřej Bílka2014-01-071-1/+7
|
* Update copyright notices with scripts/update-copyrightsAllan McRae2014-01-011-1/+1
|
* Fix fwrite() reading beyond end of buffer in error pathEric Biggers2013-10-111-6/+6
| | | | | | | | | | | Partially revert commits 2b766585f9b4ffabeef2f36200c275976b93f2c7 and de2fd463b1c0310d75084b6d774fb974075a4ad9, which were intended to fix BZ#11741 but caused another, likely worse bug, namely that fwrite() and fputs() could, in an error path, read data beyond the end of the specified buffer, and potentially even write this data to the file. Fix BZ#11741 properly by checking the return value from _IO_padn() in stdio-common/vfprintf.c.
* Avoid use of "register" as optimization hint.Joseph Myers2013-06-071-4/+4
|
* Replace __builtin_expect(..., 0) with __glibc_unlikely().Paul Pluzhnikov2013-03-051-19/+19
|
* * stdio-common/vfprintf.c (vfprintf): Check malloc return; don'tPaul Pluzhnikov2013-03-051-4/+13
| | | | call free(NULL).
* Remove __ptrvalue, __bounded and __unbounded.Joseph Myers2013-02-131-2/+2
|
* Update copyright notices with scripts/update-copyrights.Joseph Myers2013-01-021-1/+1
|
* printf should return negative value on errorSiddhesh Poyarekar2012-11-161-4/+24
| | | | | | [BZ #11741] Fixed bug where printf and family may return a spurious success when printing padded formats.
* 2012-09-28 Andreas Schwab <schwab@linux-m68k.org>Jeff Law2012-09-281-36/+3
| | | | | | | | | | | | | | [BZ #6530] * stdio-common/vfprintf.c (process_string_arg): Revert 2000-07-22 change. 2011-09-28 Jonathan Nieder <jrnieder@gmail.com> * stdio-common/Makefile (tst-sprintf-ENV): Set environment for testcase. * stdio-common/tst-sprintf.c: Include <locale.h> (main): Test sprintf's handling of incomplete multibyte characters.
* Remove use of INTDEF/INTUSE in libioAndreas Schwab2012-05-241-15/+16
|
* Tighten up vfprintf width, precision, and total length overflow handling.David S. Miller2012-04-021-19/+58
| | | | | | | | | | | | | | | | With help from Paul Eggert, Carlos O'Donell, and Roland McGrath. * stdio-common/printf-parse.h (read_int): Change return type to 'int', return -1 on INT_MAX overflow. * stdio-common/vfprintf.c (vfprintf): Validate width and precision against overflow of INT_MAX. Set errno to EOVERFLOW when 'done' overflows INT_MAX. Check for overflow of in-format-string precision values properly. Use EOVERFLOW rather than ERANGE throughout. Use SIZE_MAX not INT_MAX for integer overflow test. * stdio-common/printf-parsemb.c: If read_int signals an overflow, skip the construct in the format string but do not record anything. * stdio-common/bug22.c: Adjust to test both width/prevision INT_MAX overflow as well as total length INT_MAX overflow. Check explicitly for proper errno values.
* Move stdio-common/_itoa.h to sysdeps/genericH.J. Lu2012-03-201-2/+2
|
* Formatting fixesUlrich Drepper2012-03-061-13/+13
|
* 2012-03-02 Kees Cook <keescook@chromium.org>Kees Cook2012-03-051-3/+7
| | | | * stdio-common/vfprintf.c (vfprintf): add missing errno settings.
* 2012-03-02 Kees Cook <keescook@chromium.org>Kees Cook2012-03-051-9/+38
| | | | | | | | [BZ #13656] * stdio-common/vfprintf.c (vfprintf): Check for nargs overflow and possibly allocate from heap instead of stack. * stdio-common/bug-vfprintf-nargs.c: New file. * stdio-common/Makefile (tests): Add nargs overflow test.
* Replace FSF snail mail address with URLs.Paul Eggert2012-02-091-3/+2
|
* Fix extension of array in extended printf format handlingUlrich Drepper2011-12-171-7/+6
|
* Set stream errors in more casesUlrich Drepper2011-05-211-0/+1
| | | | Also avoid unnecessarily setting errno when testing for TTY.
* Fix allocation when handling positional parameters in printf.Petr Baudis2011-02-201-2/+3
|
* Always allow overwriting printf modifiers etc.Ulrich Drepper2010-12-241-7/+13
|
* Check for integer overflows in formatting functionsAndreas Schwab2009-09-291-18/+31
|
* * stdio-common/printf.h (struct printf_info): Add user element.Ulrich Drepper2009-04-111-14/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New types printf_arginfo_size_function, printf_va_arg_function. Declare register_printf_specifier, register_printf_modifier, register_printf_type. * stdio-common/printf-parse.h (struct printf_spec): Add size element. (union printf_arg): Add pa_user element. Adjust __printf_arginfo_table type. Add __printf_va_arg_table, __printf_modifier_table, __handle_registered_modifier_mb, and __handle_registered_modifier_wc declarations. * stdio-common/printf-parsemb.c: Recognize registered modifiers. If registered arginfo call failed try normal specifier. * stdio-common/printf-prs.c: Pass additional parameter to arginfo function. * stdio-common/Makefile (routines): Add reg-modifier and reg-type. * stdio-common/Versions: Export register_printf_modifier, register_printf_type, and register_printf_specifier for GLIBC_2.10. * stdio-common/reg-modifier.c: New file. * stdio-common/reg-type.c: New file. * stdio-common/reg-printf.c (__register_printf_specifier): New function. Mostly the old __register_printf_function function but uses locking and type of third parameter changed. (__register_printf_function): Implement using __register_printf_specifier. * stdio-common/vfprintf.c (vfprintf): Collect argument sizes in calls to arginfo functions. Allocate enough memory for user-defined types. Call new va_arg functions to get user-defined types. Try installed handlers even for existing format specifiers first.
* Simplified code and possible copy problem fixed.Ulrich Drepper2009-04-101-17/+3
|
* * stdio-common/vfprintf.c (vfprintf): Slightly more compact code.Ulrich Drepper2009-04-101-8/+15
|
* [BZ #6698]Ulrich Drepper2008-07-251-2/+2
| | | | | | | | | | * stdio-common/_i18n_number.h (_i18n_number_rewrite): Take additional parameter for end of buffer. If temporary copy is too large use malloc. * stdio-common/vfprintf.c: Adjust for _i18n_number_rewrite interface change. * stdio-common/printf_fp.c (__printf_fp): Likewise.. Account for string rewrite when allocating buffer.
* * locale/setlocale.c (setlocale): Take the setlocale lock earlier.Ulrich Drepper2008-07-201-2/+7
|
* * stdio-common/vfprintf.c (_IO_helper_overflow): In case _IO_sputn cvs/fedora-glibc-20080716T0944Ulrich Drepper2008-07-151-1/+5
| | | | doesn't manage to write anything, fail.
* * stdio-common/vfprintf.c (vfprintf): Correct overflow test.Ulrich Drepper2008-03-301-1/+2
|
* [BZ #5424, BZ #5428, BZ #5451]Ulrich Drepper2007-12-101-9/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 2007-12-08 Ulrich Drepper <drepper@redhat.com> [BZ #5424] * stdio-common/vfprintf.c: Do not overflow when adding to done. * stdio-common/Makefile (tests): Add bug22. * stdio-common/bug22.c: New file. [BZ #5451] * time/getdate.c: Fix filling in default values. * time/bug-getdate1.c: New file. * time/Makefile: Add rules to build and run bug-getdate1. * iconvdata/ebcdic-is-friss.c: Use 8bit-gap instead of 8bit-generic. * iconvdata/ebcdic-es.c: Likewise. * iconvdata/ebcdic-es-a.c: Likewise. * iconvdata/ebcdic-uk.c: Likewise. * iconvdata/iso8859-16.c: Likewise. * iconvdata/viscii.c: Likewise. * iconvdata/iso8859-9e.c: Likewise. * iconvdata/Makefile: Adjust appropriately. [BZ #5428] * wcsmbs/wchar.h: Unconditionally undefine __need_mbstate and __need_wint_t. * iconvdata/gconv-modules: Likewise.
* * stdio-common/vfprintf.c (vfprintf): Compute necessary buffer sizeUlrich Drepper2007-11-061-6/+12
| | | | | | with size_t type. * stdio-common/printf_fp.c (__print_fp): Change chars_needed type to size_t. Add casts where needed.
* * stdio-common/printf-parse.h: Include string.h and wchar.h.Ulrich Drepper2007-10-101-12/+3
| | | | | | | | | | | | | (__find_specwc): Change into __extern_always_inline function. (__find_specmb): Likewise. Remove ps argument. Use __strchrnul. (__parse_one_specmb): Remove ps argument. * stdio-common/vfprintf.c (vfprintf): Remove mbstate variable. Adjust __find_specmb and __parse_one_specmb callers. * stdio-common/printf-prs.c (parse_printf_format): Likewise. * stdio-common/printf-parsemb.c (__find_specwc, __find_specmb): Removed. (__parse_one_specmb): Remove ps argument, adjust __find_specmb caller.
* * nss/nsswitch.c (__nss_lookup_function): Don't cast &ni->known toUlrich Drepper2007-07-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | void **. * nss/nsswitch.h (service_user): Use void * type for KNOWN field. * nss/nss_files/files-hosts.c (LINE_PARSER): Cast host_addr to char * to avoid warning. * nis/nss_nis/nis-hosts.c (LINE_PARSER): Likewise. * timezone/Makefile (CFLAGS-zdump.c): Add -fwrapv. * locale/programs/ld-ctype.c (ctype_finish, set_class_defaults, allocate_arrays): Cast second argument to charmap_find_symbol to char * to avoid warnings. * locale/programs/repertoire.c (repertoire_new_char): Change from_nr, to_nr and cnt to unsigned long, adjust printf format string. * locale/programs/ld-collate.c (insert_value, handle_ellipsis): Cast second argument to new_element to char * to avoid warnings. * locale/weightwc.h (findidx): Cast &extra[-i] to const int32_t *. * intl/gettextP.h (struct loaded_domain): Change plural to const struct expression *. * intl/plural-eval.c (plural_eval): Change first argument to const struct expression *. * intl/plural-exp.c (EXTRACT_PLURAL_EXPRESSION): Change first argument to const struct expression **. * intl/plural-exp.h (EXTRACT_PLURAL_EXPRESSION, plural_eval): Adjust prototypes. * intl/loadmsgcat (_nl_unload_domain): Cast away const in call to __gettext_free_exp. * posix/fnmatch.c (fnmatch): Rearrange code to avoid maybe unitialized wstring/wpattern var warnings. * posix/runtests.c (struct a_test): Make data field const char *. * stdio-common/tst-sprintf2.c (main): Don't declere u, v and buf vars if not LDBL_MANT_DIG >= 106. * stdio-common/Makefile (CFLAGS-vfwprintf.c): Add -Wno-unitialized. * stdio-common/vfprintf.c (vfprintf): Cast first arugment to __find_specmb to avoid warning. * rt/tst-mqueue1.c (do_one_test): Add casts to avoid warnings. * debug/test-strcpy_chk.c (do_tests, do_random_tests): Add casts to avoid warnings. * sysdeps/ieee754/ldbl-96/s_roundl.c (huge): Add L suffix to initializer. * sysdeps/unix/clock_gettime.c (clock_gettime): Only define tv var when it will be actually used. * sunrpc/rpc_cmsg.c (xdr_callmsg): Cast IXDR_PUT_* to void to avoid warnings.
* [BZ #4514]Ulrich Drepper2007-05-211-4/+7
| | | | | | | | * stdio-common/vfprintf.c (vfprintf): Don't shadow workstart variable, reinitialize workend at the start of each do_positional format spec loop, free workstart before do_positional loops. (printf_unknown): Fix size of work_buffer. * stdio-common/tst-sprintf.c (main): Add 3 new testcases.
* * stdio-common/vfprintf.c (process_string_arg): OptimizeUlrich Drepper2007-05-071-2/+3
| | | | | ridiculous precision in wide char code printing multi-byte string. Reported by Jim Meyering <jim@meyering.net>.
* * stdio-common/vfprintf.c (process_string_arg): Adjust call toUlrich Drepper2007-05-051-2/+2
| | | | __mbsnrtowcs after last change.
* * stdio-common/vfprintf.c (process_string_arg): Use a VLA rather thanUlrich Drepper2007-05-021-1/+2
| | | | fixed length array for ignore.
* [BZ #4438]Ulrich Drepper2007-05-011-9/+15
| | | | | | | 2007-04-30 Ulrich Drepper <drepper@redhat.com> [BZ #4438] * stdio-common/vfprintf.c (process_string_arg): Don't overflow the stack for large precisions.
* * elf/dl-open.c (dl_open_worker): Declare l in 2 different cvs/fedora-glibc-20070317T2130Ulrich Drepper2007-03-171-1/+2
| | | | | | | | | | | | | | | | | smaller scopes. * elf/dl-dst.h (DL_DST_REQ_STATIC): Add l as macro argument. (DL_DST_REQUIRED): Adjust user. * include/dlfcn.h (struct link_map): New forward decl. * inet/getnameinfo.c: Include stddef.h. (getnameinfo): Use offsetof. * time/tst-mktime2.c (do_test): Don't rely on signed wrap. * stdio-common/vfprintf.c (_itoa): Undef before redefining. * string/strerror_l.c: Include stdlib.h.