[llvm-commits] llvm-gcc patch: Map Stomp
Bill Wendling
isanbard at gmail.com
Sat Jan 6 19:01:42 PST 2007
Hi all,
I committed this patch. It's one that was committed Apple's GCC. It
solves a problem where an address gotten from a map could be stomped
on by a subsequent call-back function.
-bw
In the libcpp directory:
2007-01-06 Bill Wendling <wendling at apple.com>
Radar 4897123
* directives.c (_cpp_do_file_change): Array of maps could
change after
the "file_change" callback. We should relookup the map
afterwards.
Index: directives.c
===================================================================
--- directives.c (revision 240)
+++ directives.c (working copy)
@@ -943,8 +943,24 @@
if (map != NULL)
linemap_line_start (pfile->line_table, map->to_line, 127);
+ /* APPLE LOCAL begin 4897123 */
if (pfile->cb.file_change)
- pfile->cb.file_change (pfile, map);
+ {
+ struct line_map *old_maps = pfile->line_table->maps;
+ source_location old_loc = 0;
+
+ if (map)
+ old_loc = map->start_location;
+
+ pfile->cb.file_change (pfile, map);
+
+ /* The file_change callback could reallocate the line_table
maps causing
+ "map" we got to be invalid */
+ if (map && old_maps != pfile->line_table->maps)
+ map = linemap_lookup (pfile->line_table, old_loc);
+ }
+ /* APPLE LOCAL end 4897123 */
+
/* APPLE LOCAL begin 4137741 */
/* If file change debug hook callbacks are being deferred, we will
More information about the llvm-commits
mailing list