This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
(perl #127743) limit the number of extra refs returned by STORABLE_freeze
authorTony Cook <tony@develop-help.com>
Mon, 20 Nov 2017 23:05:28 +0000 (00:05 +0100)
committerTony Cook <tony@develop-help.com>
Thu, 8 Feb 2018 02:58:10 +0000 (13:58 +1100)
Ensure some over enthusiastic STORABLE_freeze() doesn't cause us to
emit a negative reference count for SX_HOOK.

This fails to be parsed by older versions and flags 64-bit ids for new
versions of Storable.

dist/Storable/Storable.xs

index 8e013d7..819d743 100644 (file)
@@ -3598,6 +3598,12 @@ static int store_hook(
         }
     }
 
+#ifdef HAS_U64
+    if (count > I32_MAX) {
+       CROAK(("Too many references returned by STORABLE_freeze()"));
+    }
+#endif
+
     /*
      * If they returned more than one item, we need to serialize some
      * extra references if not already done.