This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
5860085
)
Coverity reports that Storable can potentially cause a NULL pointer
author
Nicholas Clark
<nick@ccl4.org>
Sat, 15 Apr 2006 21:43:13 +0000
(21:43 +0000)
committer
Nicholas Clark
<nick@ccl4.org>
Sat, 15 Apr 2006 21:43:13 +0000
(21:43 +0000)
dereference while iterating a hash. This should never happen unless
the hash lies about how many keys it has, so croak if a fib is spotted.
p4raw-id: //depot/perl@27825
ext/Storable/Storable.xs
patch
|
blob
|
blame
|
history
diff --git
a/ext/Storable/Storable.xs
b/ext/Storable/Storable.xs
index
84d76aa
..
a8beda1
100644
(file)
--- a/
ext/Storable/Storable.xs
+++ b/
ext/Storable/Storable.xs
@@
-2329,7
+2329,11
@@
static int store_hash(pTHX_ stcxt_t *cxt, HV *hv)
#else
HE *he = hv_iternext(hv);
#endif
- SV *key = hv_iterkeysv(he);
+ SV *key;
+
+ if (!he)
+ CROAK(("Hash %p inconsistent - expected %d keys, %dth is NULL", hv, len, i));
+ key = hv_iterkeysv(he);
av_store(av, AvFILLp(av)+1, key); /* av_push(), really */
}