Enable unit tests

Backport fix for a NULL pointer dereference
Resolves: #1502655
This commit is contained in:
Marek Kasik 2017-10-17 10:10:52 +02:00
parent 97dfa015f0
commit fe2883767d
2 changed files with 43 additions and 1 deletions

View File

@ -0,0 +1,32 @@
From 91637c8319202758f52c6bd31d7264d6b6a74ee1 Mon Sep 17 00:00:00 2001
From: PHO <pho@cielonegro.org>
Date: Fri, 2 Oct 2015 09:31:46 +0900
Subject: [PATCH] Fix NULL pointer dereference that occurs when byte swapping
is needed
cdrom_cache_handler() calls cdio_cddap_read_timed() with buffer == NULL. When this happens on a platform where byte swapping is needed, the latter crashes for dereferencing a NULL pointer.
---
configure.ac | 14 ++++++----
lib/cdda_interface/interface.c | 2 +-
test/.gitignore | 5 ++++
test/Makefile.am | 4 +--
test/endian.sh.in | 59 ++++++++++++++++++++++++++++++++++++++++++
5 files changed, 76 insertions(+), 8 deletions(-)
create mode 100644 test/endian.sh.in
diff --git a/lib/cdda_interface/interface.c b/lib/cdda_interface/interface.c
index 08a96f3..bfb9ac3 100644
--- a/lib/cdda_interface/interface.c
+++ b/lib/cdda_interface/interface.c
@@ -155,7 +155,7 @@ cdio_cddap_read_timed(cdrom_drive_t *d, void *buffer, lsn_t beginsector,
if ( d->bigendianp == -1 ) /* not determined yet */
d->bigendianp = data_bigendianp(d);
- if ( d->b_swap_bytes && d->bigendianp != bigendianp() ) {
+ if ( buffer && d->b_swap_bytes && d->bigendianp != bigendianp() ) {
int i;
uint16_t *p=(uint16_t *)buffer;
long els=sectors*CDIO_CD_FRAMESIZE_RAW/2;
--
2.14.2

View File

@ -1,12 +1,13 @@
Name: libcdio-paranoia Name: libcdio-paranoia
Version: 10.2+0.93+1 Version: 10.2+0.93+1
Release: 10%{?dist} Release: 11%{?dist}
Summary: CD paranoia on top of libcdio Summary: CD paranoia on top of libcdio
Group: System Environment/Libraries Group: System Environment/Libraries
License: GPLv3+ License: GPLv3+
URL: http://www.gnu.org/software/libcdio/ URL: http://www.gnu.org/software/libcdio/
Source0: http://ftp.gnu.org/gnu/libcdio/libcdio-paranoia-%{version}.tar.gz Source0: http://ftp.gnu.org/gnu/libcdio/libcdio-paranoia-%{version}.tar.gz
Patch0: libcdio-paranoia-manpage.patch Patch0: libcdio-paranoia-manpage.patch
Patch1: libcdio-NULL-pointer-dereference.patch
BuildRequires: pkgconfig BuildRequires: pkgconfig
BuildRequires: gettext-devel BuildRequires: gettext-devel
BuildRequires: chrpath BuildRequires: chrpath
@ -38,6 +39,7 @@ This package contains header files and libraries for %{name}.
%prep %prep
%setup -q %setup -q
%patch0 -p1 %patch0 -p1
%patch1 -p1
# fix pkgconfig files # fix pkgconfig files
sed -i -e 's,-I${includedir},-I${includedir}/cdio,g' libcdio_paranoia.pc.in sed -i -e 's,-I${includedir},-I${includedir}/cdio,g' libcdio_paranoia.pc.in
@ -69,6 +71,9 @@ cp -a $RPM_BUILD_ROOT%{_includedir}/cdio/paranoia/*.h $RPM_BUILD_ROOT%{_included
chrpath --delete $RPM_BUILD_ROOT%{_bindir}/* chrpath --delete $RPM_BUILD_ROOT%{_bindir}/*
chrpath --delete $RPM_BUILD_ROOT%{_libdir}/*.so.* chrpath --delete $RPM_BUILD_ROOT%{_libdir}/*.so.*
%check
make %{?_smp_mflags} check
%post -p /sbin/ldconfig %post -p /sbin/ldconfig
%postun -p /sbin/ldconfig %postun -p /sbin/ldconfig
@ -92,6 +97,11 @@ chrpath --delete $RPM_BUILD_ROOT%{_libdir}/*.so.*
%changelog %changelog
* Tue Oct 17 2017 Marek Kasik <mkasik@redhat.com> - 10.2+0.93+1-11
- Enable unit tests
- Backport fix for a NULL pointer dereference
- Resolves: #1502655
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 10.2+0.93+1-10 * Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 10.2+0.93+1-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild