diff options
author | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-01-15 15:52:28 +0000 |
---|---|---|
committer | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-01-15 15:52:28 +0000 |
commit | 11d39288180ad78e043f85fa7d87e2f850ad4b04 (patch) | |
tree | 6789f0adc8213a5b1a45147e509f7575f9794ec7 /libgfortran | |
parent | 25cd8ffa4332aa52a8f176f61f674b4b14a9b738 (diff) | |
download | gcc-11d39288180ad78e043f85fa7d87e2f850ad4b04.tar.gz |
2010-01-15 Jerry DeLisle <jvdelisle@gcc.gnu.org>
* io/format.c (parse_format): Set limit on size of format strings that
will be cached.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155939 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 5 | ||||
-rw-r--r-- | libgfortran/io/format.c | 7 |
2 files changed, 11 insertions, 1 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index fbd9dd43309..0b24143c2b9 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,8 @@ +2010-01-15 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + * io/format.c (parse_format): Set limit on size of format strings that + will be cached. + 2010-01-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> * configure: Regenerate. diff --git a/libgfortran/io/format.c b/libgfortran/io/format.c index cafea8732e4..13516d2f8a6 100644 --- a/libgfortran/io/format.c +++ b/libgfortran/io/format.c @@ -1212,13 +1212,18 @@ revert (st_parameter_dt *dtp) /* parse_format()-- Parse a format string. */ +#define FORMAT_CACHE_STRING_LIMIT 256 + void parse_format (st_parameter_dt *dtp) { format_data *fmt; bool format_cache_ok; - format_cache_ok = !is_internal_unit (dtp); + /* Don't cache for internal units and set an arbitrary limit on the size of + format strings we will cache. (Avoids memory issues.) */ + format_cache_ok = !is_internal_unit (dtp) + && (dtp->format_len < FORMAT_CACHE_STRING_LIMIT ); /* Lookup format string to see if it has already been parsed. */ if (format_cache_ok) |