[perl-Digest-SHA/f18] Fix RT#82655

Jitka Plesnikova jplesnik at fedoraproject.org
Wed Jan 16 12:27:04 UTC 2013


commit df794aefcc6be6e23edd66af0ab935ff2770e2f9
Author: Jitka Plesnikova <jplesnik at redhat.com>
Date:   Wed Jan 16 13:09:35 2013 +0100

    Fix RT#82655

 Digest-SHA-5.81-Fix-RT82655.patch |   47 +++++++++++++++++++++++++++++++++++++
 perl-Digest-SHA.spec              |   10 +++++++-
 2 files changed, 56 insertions(+), 1 deletions(-)
---
diff --git a/Digest-SHA-5.81-Fix-RT82655.patch b/Digest-SHA-5.81-Fix-RT82655.patch
new file mode 100644
index 0000000..b25b39a
--- /dev/null
+++ b/Digest-SHA-5.81-Fix-RT82655.patch
@@ -0,0 +1,47 @@
+--- Digest-SHA-5.74/lib/Digest/SHA.pm.orig	2013-01-16 10:44:33.185972614 +0100
++++ Digest-SHA-5.74/lib/Digest/SHA.pm	2013-01-16 10:47:37.127369861 +0100
+@@ -50,7 +50,7 @@
+ 			return($class);
+ 		}
+ 		shaclose($$class) if $$class;
+-		$$class = shaopen($alg) || return;
++		return unless $$class = shaopen($alg);
+ 		return($class);
+ 	}
+ 	$alg = 1 unless defined $alg;
+@@ -163,18 +163,21 @@
+ 
+ sub dump {
+ 	my $self = shift;
+-	my $file = shift || "";
++	my $file = shift;
+ 
++	$file = "" unless defined $file;
+ 	shadump($file, $$self) || return;
+ 	return($self);
+ }
+ 
+ sub load {
+ 	my $class = shift;
+-	my $file = shift || "";
++	my $file = shift;
++
++	$file = "" unless defined $file;
+ 	if (ref($class)) {	# instance method
+ 		shaclose($$class) if $$class;
+-		$$class = shaload($file) || return;
++		return unless $$class = shaload($file);
+ 		return($class);
+ 	}
+ 	my $state = shaload($file) || return;
+--- Digest-SHA-5.74/src/sha.c.orig	2013-01-16 10:49:43.624336994 +0100
++++ Digest-SHA-5.74/src/sha.c	2013-01-16 10:51:33.661168900 +0100
+@@ -272,7 +272,7 @@
+ /* shaopen: creates a new digest object */
+ SHA *shaopen(int alg)
+ {
+-	SHA *s;
++	SHA *s = NULL;
+ 
+ 	if (alg != SHA1 && alg != SHA224 && alg != SHA256 &&
+ 		alg != SHA384    && alg != SHA512 &&
diff --git a/perl-Digest-SHA.spec b/perl-Digest-SHA.spec
index 9e976e8..6d9110e 100644
--- a/perl-Digest-SHA.spec
+++ b/perl-Digest-SHA.spec
@@ -1,12 +1,16 @@
 Name:           perl-Digest-SHA
 Epoch:          1
 Version:        5.74
-Release:        2%{?dist}
+Release:        3%{?dist}
 Summary:        Perl extension for SHA-1/224/256/384/512
 License:        GPL+ or Artistic
 Group:          Development/Libraries
 URL:            http://search.cpan.org/dist/Digest-SHA/
 Source0:        http://www.cpan.org/authors/id/M/MS/MSHELOR/Digest-SHA-%{version}.tar.gz
+# Fix double-free when loading Digest::SHA object
+# https://rt.cpan.org/Public/Bug/Display.html?id=82655
+Patch0:         Digest-SHA-5.81-Fix-RT82655.patch
+
 BuildRequires:  perl(ExtUtils::MakeMaker)
 # Run-time
 BuildRequires:  perl(Carp)
@@ -34,6 +38,7 @@ handle all types of input, including partial-byte data.
 
 %prep
 %setup -q -n Digest-SHA-%{version}
+%patch0 -p1
 chmod -x examples/*
 perl -MExtUtils::MakeMaker -e 'ExtUtils::MM_Unix->fixin(q{examples/dups})'
 
@@ -59,6 +64,9 @@ make test
 %{_mandir}/man3/*
 
 %changelog
+* Wed Jan 16 2013 Jitka Plesnikova <jplesnik at redhat.com> - 1:5.74-3
+- Add patch to fix RT#82655.
+
 * Fri Nov 30 2012 Petr Pisar <ppisar at redhat.com> - 1:5.74-2
 - Restore epoch value broken in 5.73 bump
 


More information about the scm-commits mailing list