silence false error detected by valgrind (#968288)
This commit is contained in:
parent
b5413f756a
commit
03c131f7fa
102
libgcrypt-1.5.2-mpicoder-gccopt.patch
Normal file
102
libgcrypt-1.5.2-mpicoder-gccopt.patch
Normal file
@ -0,0 +1,102 @@
|
||||
diff -up libgcrypt-1.5.2/mpi/mpicoder.c.gccopt libgcrypt-1.5.2/mpi/mpicoder.c
|
||||
--- libgcrypt-1.5.2/mpi/mpicoder.c.gccopt 2013-04-18 16:48:42.000000000 +0200
|
||||
+++ libgcrypt-1.5.2/mpi/mpicoder.c 2013-06-20 10:24:57.241510589 +0200
|
||||
@@ -555,16 +555,16 @@ gcry_mpi_print (enum gcry_mpi_format for
|
||||
extra=1;
|
||||
}
|
||||
|
||||
- if (buffer && n > len)
|
||||
- {
|
||||
- /* The provided buffer is too short. */
|
||||
- gcry_free (tmp);
|
||||
- return gcry_error (GPG_ERR_TOO_SHORT);
|
||||
- }
|
||||
if (buffer)
|
||||
{
|
||||
unsigned char *s = buffer;
|
||||
|
||||
+ if (n > len)
|
||||
+ {
|
||||
+ /* The provided buffer is too short. */
|
||||
+ gcry_free (tmp);
|
||||
+ return gcry_error (GPG_ERR_TOO_SHORT);
|
||||
+ }
|
||||
if (extra)
|
||||
*s++ = 0;
|
||||
memcpy (s, tmp, n-extra);
|
||||
@@ -580,12 +580,12 @@ gcry_mpi_print (enum gcry_mpi_format for
|
||||
/* Note: We ignore the sign for this format. */
|
||||
/* FIXME: for performance reasons we should put this into
|
||||
mpi_aprint because we can then use the buffer directly. */
|
||||
- if (buffer && n > len)
|
||||
- return gcry_error (GPG_ERR_TOO_SHORT);
|
||||
if (buffer)
|
||||
{
|
||||
unsigned char *tmp;
|
||||
|
||||
+ if (n > len)
|
||||
+ return gcry_error (GPG_ERR_TOO_SHORT);
|
||||
tmp = _gcry_mpi_get_buffer (a, &n, NULL);
|
||||
if (!tmp)
|
||||
return gpg_error_from_syserror ();
|
||||
@@ -603,14 +603,13 @@ gcry_mpi_print (enum gcry_mpi_format for
|
||||
if( a->sign )
|
||||
return gcry_error (GPG_ERR_INV_ARG);
|
||||
|
||||
- if (buffer && n+2 > len)
|
||||
- return gcry_error (GPG_ERR_TOO_SHORT);
|
||||
-
|
||||
if (buffer)
|
||||
{
|
||||
unsigned char *tmp;
|
||||
unsigned char *s = buffer;
|
||||
|
||||
+ if (n+2 > len)
|
||||
+ return gcry_error (GPG_ERR_TOO_SHORT);
|
||||
s[0] = nbits >> 8;
|
||||
s[1] = nbits;
|
||||
|
||||
@@ -641,16 +640,16 @@ gcry_mpi_print (enum gcry_mpi_format for
|
||||
extra=1;
|
||||
}
|
||||
|
||||
- if (buffer && n+4 > len)
|
||||
- {
|
||||
- gcry_free(tmp);
|
||||
- return gcry_error (GPG_ERR_TOO_SHORT);
|
||||
- }
|
||||
-
|
||||
if (buffer)
|
||||
{
|
||||
unsigned char *s = buffer;
|
||||
|
||||
+ if (n+4 > len)
|
||||
+ {
|
||||
+ gcry_free(tmp);
|
||||
+ return gcry_error (GPG_ERR_TOO_SHORT);
|
||||
+ }
|
||||
+
|
||||
*s++ = n >> 24;
|
||||
*s++ = n >> 16;
|
||||
*s++ = n >> 8;
|
||||
@@ -677,15 +676,15 @@ gcry_mpi_print (enum gcry_mpi_format for
|
||||
if (!n || (*tmp & 0x80))
|
||||
extra = 2;
|
||||
|
||||
- if (buffer && 2*n + extra + !!a->sign + 1 > len)
|
||||
- {
|
||||
- gcry_free(tmp);
|
||||
- return gcry_error (GPG_ERR_TOO_SHORT);
|
||||
- }
|
||||
if (buffer)
|
||||
{
|
||||
unsigned char *s = buffer;
|
||||
|
||||
+ if (2*n + extra + !!a->sign + 1 > len)
|
||||
+ {
|
||||
+ gcry_free(tmp);
|
||||
+ return gcry_error (GPG_ERR_TOO_SHORT);
|
||||
+ }
|
||||
if (a->sign)
|
||||
*s++ = '-';
|
||||
if (extra)
|
@ -1,6 +1,6 @@
|
||||
Name: libgcrypt
|
||||
Version: 1.5.2
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
URL: http://www.gnupg.org/
|
||||
Source0: libgcrypt-%{version}-hobbled.tar.xz
|
||||
# The original libgcrypt sources now contain potentially patented ECC
|
||||
@ -27,6 +27,8 @@ Patch9: libgcrypt-1.5.0-leak.patch
|
||||
Patch11: libgcrypt-1.5.1-use-poll.patch
|
||||
# compile rijndael with -fno-strict-aliasing
|
||||
Patch12: libgcrypt-1.5.2-aliasing.patch
|
||||
# slight optimalization of mpicoder.c to silence Valgrind (#968288)
|
||||
Patch13: libgcrypt-1.5.2-mpicoder-gccopt.patch
|
||||
|
||||
%define gcrylibdir %{_libdir}
|
||||
|
||||
@ -70,6 +72,7 @@ applications using libgcrypt.
|
||||
%patch9 -p1 -b .leak
|
||||
%patch11 -p1 -b .use-poll
|
||||
%patch12 -p1 -b .aliasing
|
||||
%patch13 -p1 -b .gccopt
|
||||
|
||||
%build
|
||||
%configure --disable-static \
|
||||
@ -171,6 +174,9 @@ exit 0
|
||||
%doc COPYING
|
||||
|
||||
%changelog
|
||||
* Thu Jun 20 2013 Tomáš Mráz <tmraz@redhat.com> 1.5.2-3
|
||||
- silence false error detected by valgrind (#968288)
|
||||
|
||||
* Thu Apr 25 2013 Tomáš Mráz <tmraz@redhat.com> 1.5.2-2
|
||||
- silence strict aliasing warning in Rijndael
|
||||
- apply UsrMove
|
||||
|
Loading…
Reference in New Issue
Block a user