Dereference token_re on older Perls Broken in commit 633c4d3.
Fixes LUCY-297. Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/632a46b8 Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/632a46b8 Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/632a46b8 Branch: refs/heads/master Commit: 632a46b8b8df694d320cda2bcec72d5248e9a49f Parents: 97d51f7 Author: Nick Wellnhofer <[email protected]> Authored: Mon Apr 4 17:59:56 2016 +0200 Committer: Nick Wellnhofer <[email protected]> Committed: Tue Apr 5 11:48:11 2016 +0200 ---------------------------------------------------------------------- perl/xs/Lucy/Analysis/RegexTokenizer.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/632a46b8/perl/xs/Lucy/Analysis/RegexTokenizer.c ---------------------------------------------------------------------- diff --git a/perl/xs/Lucy/Analysis/RegexTokenizer.c b/perl/xs/Lucy/Analysis/RegexTokenizer.c index b558875..9a3fcc6 100644 --- a/perl/xs/Lucy/Analysis/RegexTokenizer.c +++ b/perl/xs/Lucy/Analysis/RegexTokenizer.c @@ -58,9 +58,13 @@ lucy_RegexTokenizer_init(lucy_RegexTokenizer *self, #if (PERL_VERSION > 10) REGEXP *rx = SvRX((SV*)token_re); #else + if (!SvROK(token_re)) { + THROW(CFISH_ERR, "token_re is not a qr// entity"); + } + SV *inner = SvRV(token_re); MAGIC *magic = NULL; - if (SvMAGICAL((SV*)token_re)) { - magic = mg_find((SV*)token_re, PERL_MAGIC_qr); + if (SvMAGICAL((SV*)inner)) { + magic = mg_find((SV*)inner, PERL_MAGIC_qr); } if (!magic) { THROW(CFISH_ERR, "token_re is not a qr// entity");
