public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 2/2] Simplify tzfile fstat failure code
  2018-09-09 15:26 [PATCH 1/2] Fix tzfile low-memory assertion failure Paul Eggert
@ 2018-09-09 15:26 ` Paul Eggert
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggert @ 2018-09-09 15:26 UTC (permalink / raw)
  To: libc-alpha; +Cc: Paul Eggert

[BZ #21716]
* time/tzfile.c (__tzfile_read): Simplify slightly.
---
 ChangeLog     | 4 ++++
 time/tzfile.c | 5 +----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6f95da9ce2..1b768dc17a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2018-09-09  Paul Eggert  <eggert@cs.ucla.edu>
 
+	Simplify tzfile fstat failure code
+	[BZ #21716]
+	* time/tzfile.c (__tzfile_read): Simplify slightly.
+
 	Fix tzfile low-memory assertion failure
 	[BZ #21716]
 	* time/tzfile.c (__tzfile_read): Check for memory exhaustion
diff --git a/time/tzfile.c b/time/tzfile.c
index ea6e940303..72ef75f074 100644
--- a/time/tzfile.c
+++ b/time/tzfile.c
@@ -168,10 +168,7 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
 
   /* Get information about the file we are actually using.  */
   if (fstat64 (__fileno (f), &st) != 0)
-    {
-      fclose (f);
-      goto ret_free_transitions;
-    }
+    goto lose;
 
   free ((void *) transitions);
   transitions = NULL;
-- 
2.17.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 1/2] Fix tzfile low-memory assertion failure
@ 2018-09-09 15:26 Paul Eggert
  2018-09-09 15:26 ` [PATCH 2/2] Simplify tzfile fstat failure code Paul Eggert
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Eggert @ 2018-09-09 15:26 UTC (permalink / raw)
  To: libc-alpha; +Cc: Paul Eggert

[BZ #21716]
* time/tzfile.c (__tzfile_read): Check for memory exhaustion
when registering time zone abbreviations.
---
 ChangeLog     | 7 +++++++
 time/tzfile.c | 3 ++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 611caf9bd8..6f95da9ce2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2018-09-09  Paul Eggert  <eggert@cs.ucla.edu>
+
+	Fix tzfile low-memory assertion failure
+	[BZ #21716]
+	* time/tzfile.c (__tzfile_read): Check for memory exhaustion
+	when registering time zone abbreviations.
+
 2018-09-06  Stefan Liebler  <stli@linux.ibm.com>
 
 	* sysdeps/s390/fpu/libm-test-ulps: Regenerated.
diff --git a/time/tzfile.c b/time/tzfile.c
index 2a385b92bc..ea6e940303 100644
--- a/time/tzfile.c
+++ b/time/tzfile.c
@@ -410,7 +410,8 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
 
   /* First "register" all timezone names.  */
   for (i = 0; i < num_types; ++i)
-    (void) __tzstring (&zone_names[types[i].idx]);
+    if (__tzstring (&zone_names[types[i].idx]) == NULL)
+      goto ret_free_transitions;
 
   /* Find the standard and daylight time offsets used by the rule file.
      We choose the offsets in the types of each flavor that are
-- 
2.17.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-09-09 15:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-09 15:26 [PATCH 1/2] Fix tzfile low-memory assertion failure Paul Eggert
2018-09-09 15:26 ` [PATCH 2/2] Simplify tzfile fstat failure code Paul Eggert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).