Patch to check for formats reading through null pointer
Jeffrey A Law
law@redhat.com
Wed Dec 6 17:35:00 GMT 2000
In message <Pine.LNX.4.30.0012070031120.23840-100000@kern.srcf.societies.cam.
ac.uk>you write:
> This patch adds a minor format checking feature: as well as the
> existing checks for formats writing into constant objects or through
> null pointers, this patch adds a check for formats reading through
> null pointers. It also cleans up the logic for these checks with the
> GNU scanf %a flag (which happened to work anyway since all formats
> taking %a did have the "W" flag).
>
> Bootstrapped with no regressions on i686-pc-linux-gnu. OK to commit?
>
> gcc/ChangeLog:
> 2000-12-07 Joseph S. Myers <jsm28@cam.ac.uk>
>
> * c-common.c (format_wanted_type): Add reading_from_flag.
> (print_char_table): Mark %s and %S formats with flag "R".
> (check_format_info_main): Set up reading_from_flag appropriately.
> If aflag, always set writing_in_flag rather than relying on the
> format used being a scanf format and so having it set.
> (check_format_types): Check for formats reading through null
> pointers.
>
> gcc/testsuite/ChangeLog:
> 2000-12-07 Joseph S. Myers <jsm28@cam.ac.uk>
>
> * gcc.dg/c90-printf-1.c: Add test for printf formats reading
> through a null pointer.
Approved. Please install.
Thanks,
jeff
More information about the Gcc-patches
mailing list