|
|
1e5834 |
From c898bd4f5880bd7ddbf5987024c2748eae3d88a7 Mon Sep 17 00:00:00 2001
|
|
|
1e5834 |
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
|
|
1e5834 |
Date: Wed, 12 Mar 2014 10:17:16 +0100
|
|
|
1e5834 |
Subject: [PATCH] Check for ISA when invoking methods
|
|
|
1e5834 |
MIME-Version: 1.0
|
|
|
1e5834 |
Content-Type: text/plain; charset=UTF-8
|
|
|
1e5834 |
Content-Transfer-Encoding: 8bit
|
|
|
1e5834 |
|
|
|
1e5834 |
After:
|
|
|
1e5834 |
|
|
|
1e5834 |
use Digest::SHA;
|
|
|
1e5834 |
my $d=Digest::SHA->add(qq(a));
|
|
|
1e5834 |
|
|
|
1e5834 |
calling $d->hashsize() and other methods resulted in crash.
|
|
|
1e5834 |
|
|
|
1e5834 |
This is relevant patch from Digest-SHA-5.87.
|
|
|
1e5834 |
|
|
|
1e5834 |
Perl RT#121421
|
|
|
1e5834 |
<https://bugzilla.redhat.com/show_bug.cgi?id=1075478>
|
|
|
1e5834 |
|
|
|
1e5834 |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
1e5834 |
---
|
|
|
1e5834 |
SHA.xs | 8 ++++++++
|
|
|
1e5834 |
1 file changed, 8 insertions(+)
|
|
|
1e5834 |
|
|
|
1e5834 |
diff --git a/SHA.xs b/SHA.xs
|
|
|
1e5834 |
index 3caf8ef..69908a0 100644
|
|
|
1e5834 |
--- a/SHA.xs
|
|
|
1e5834 |
+++ b/SHA.xs
|
|
|
1e5834 |
@@ -34,6 +34,8 @@ shaclose(s)
|
|
|
1e5834 |
CODE:
|
|
|
1e5834 |
RETVAL = shaclose(s);
|
|
|
1e5834 |
sv_setiv(SvRV(ST(0)), 0);
|
|
|
1e5834 |
+OUTPUT:
|
|
|
1e5834 |
+ RETVAL
|
|
|
1e5834 |
|
|
|
1e5834 |
int
|
|
|
1e5834 |
shadump(file, s)
|
|
|
1e5834 |
@@ -186,6 +188,8 @@ PREINIT:
|
|
|
1e5834 |
SHA *state;
|
|
|
1e5834 |
int result;
|
|
|
1e5834 |
PPCODE:
|
|
|
1e5834 |
+ if (!sv_isa(self, "Digest::SHA"))
|
|
|
1e5834 |
+ XSRETURN_UNDEF;
|
|
|
1e5834 |
state = INT2PTR(SHA *, SvIV(SvRV(SvRV(self))));
|
|
|
1e5834 |
result = ix ? shaalg(state) : shadsize(state) << 3;
|
|
|
1e5834 |
ST(0) = sv_2mortal(newSViv(result));
|
|
|
1e5834 |
@@ -200,6 +204,8 @@ PREINIT:
|
|
|
1e5834 |
STRLEN len;
|
|
|
1e5834 |
SHA *state;
|
|
|
1e5834 |
PPCODE:
|
|
|
1e5834 |
+ if (!sv_isa(self, "Digest::SHA"))
|
|
|
1e5834 |
+ XSRETURN_UNDEF;
|
|
|
1e5834 |
state = INT2PTR(SHA *, SvIV(SvRV(SvRV(self))));
|
|
|
1e5834 |
for (i = 1; i < items; i++) {
|
|
|
1e5834 |
data = (unsigned char *) (SvPVbyte(ST(i), len));
|
|
|
1e5834 |
@@ -224,6 +230,8 @@ PREINIT:
|
|
|
1e5834 |
SHA *state;
|
|
|
1e5834 |
char *result;
|
|
|
1e5834 |
PPCODE:
|
|
|
1e5834 |
+ if (!sv_isa(self, "Digest::SHA"))
|
|
|
1e5834 |
+ XSRETURN_UNDEF;
|
|
|
1e5834 |
state = INT2PTR(SHA *, SvIV(SvRV(SvRV(self))));
|
|
|
1e5834 |
shafinish(state);
|
|
|
1e5834 |
len = 0;
|
|
|
1e5834 |
--
|
|
|
1e5834 |
1.8.5.3
|
|
|
1e5834 |
|