diff options
author | Nicholas Clark <nick@ccl4.org> | 2009-10-06 09:24:08 +0200 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2009-10-06 09:24:08 +0200 |
commit | ab8be49d36ac8fa0d20103344a61b3e7233fcba4 (patch) | |
tree | 594f5eef4cb6dee48268af079b2b5e1d63b74805 /sv.c | |
parent | 64da3008c02a30fac03c1d2dc01e935495f210f8 (diff) | |
download | perl-ab8be49d36ac8fa0d20103344a61b3e7233fcba4.tar.gz |
Don't attempt UTF-8 cache assertion for SVs with invalid SvPVX() (eg overloaded)
Fixes RT 69422.
However, I'm not actually sure whether we should even be caching the results of
UTF-8 operations on overloading, given that nothing stops overloading returning
a different value every time it's called.
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -6290,7 +6290,13 @@ S_utf8_mg_pos_cache_update(pTHX_ SV *const sv, MAGIC **const mgp, const STRLEN b } assert(cache); - if (PL_utf8cache < 0) { + if (PL_utf8cache < 0 && SvPOKp(sv)) { + /* SvPOKp() because it's possible that sv has string overloading, and + therefore is a reference, hence SvPVX() is actually a pointer. + This cures the (very real) symptoms of RT 69422, but I'm not actually + sure whether we should even be caching the results of UTF-8 + operations on overloading, given that nothing stops overloading + returning a different value every time it's called. */ const U8 *start = (const U8 *) SvPVX_const(sv); const STRLEN realutf8 = utf8_length(start, start + byte); |