From c3bcdaf164c1b3fbca142ffeaf281928344ad777 Mon Sep 17 00:00:00 2001 From: dcoppa Date: Wed, 10 Oct 2012 10:51:01 +0000 Subject: [PATCH] Apply two fixes from upstream git: - Corrupted FLAC files scan can result in heavy CPU consumption: fix it by considering a file as being invalid if a 0 length block is found - Fix a crash when saving xm files While here, also sync patches/patch-tests_CMakeLists_txt with upstream --- audio/taglib/Makefile | 3 ++- .../patches/patch-taglib_flac_flacfile_cpp | 17 +++++++++++++ .../taglib/patches/patch-taglib_xm_xmfile_cpp | 16 ++++++++++++ .../taglib/patches/patch-tests_CMakeLists_txt | 25 ++++++++++++------- 4 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 audio/taglib/patches/patch-taglib_flac_flacfile_cpp create mode 100644 audio/taglib/patches/patch-taglib_xm_xmfile_cpp diff --git a/audio/taglib/Makefile b/audio/taglib/Makefile index 5a5c9013cc3..28579168358 100644 --- a/audio/taglib/Makefile +++ b/audio/taglib/Makefile @@ -1,7 +1,8 @@ -# $OpenBSD: Makefile,v 1.24 2012/10/01 07:31:17 dcoppa Exp $ +# $OpenBSD: Makefile,v 1.25 2012/10/10 10:51:01 dcoppa Exp $ COMMENT= managing meta-data of audio formats DISTNAME= taglib-1.8 +REVISION= 0 CATEGORIES= audio devel MASTER_SITES= https://github.com/downloads/taglib/taglib/ diff --git a/audio/taglib/patches/patch-taglib_flac_flacfile_cpp b/audio/taglib/patches/patch-taglib_flac_flacfile_cpp new file mode 100644 index 00000000000..69b6ec961b8 --- /dev/null +++ b/audio/taglib/patches/patch-taglib_flac_flacfile_cpp @@ -0,0 +1,17 @@ +$OpenBSD: patch-taglib_flac_flacfile_cpp,v 1.1 2012/10/10 10:51:02 dcoppa Exp $ + +Corrupted FLAC files scan can result in heavy CPU consumption: fix +it by considering a file as being invalid if a 0 length block is +found (upstream git commit ad9ffc62e6fac5c47f46eb96b39c614e32742eb5) + +--- taglib/flac/flacfile.cpp.orig Wed Oct 10 12:21:53 2012 ++++ taglib/flac/flacfile.cpp Wed Oct 10 12:22:25 2012 +@@ -425,7 +425,7 @@ void FLAC::File::scan() + length = header.mid(1, 3).toUInt(); + + ByteVector data = readBlock(length); +- if(data.size() != length) { ++ if(data.size() != length || length == 0) { + debug("FLAC::File::scan() -- FLAC stream corrupted"); + setValid(false); + return; diff --git a/audio/taglib/patches/patch-taglib_xm_xmfile_cpp b/audio/taglib/patches/patch-taglib_xm_xmfile_cpp new file mode 100644 index 00000000000..a4345695f95 --- /dev/null +++ b/audio/taglib/patches/patch-taglib_xm_xmfile_cpp @@ -0,0 +1,16 @@ +$OpenBSD: patch-taglib_xm_xmfile_cpp,v 1.1 2012/10/10 10:51:02 dcoppa Exp $ + +Fix a crash when saving xm files +(upstream git commit 2d7414733eaa3263868c74abfa6cff38a8afe8d3) + +--- taglib/xm/xmfile.cpp.orig Wed Oct 10 12:24:15 2012 ++++ taglib/xm/xmfile.cpp Wed Oct 10 12:24:40 2012 +@@ -443,7 +443,7 @@ bool XM::File::save() + return false; + + uint len = std::min(22UL, instrumentHeaderSize - 4U); +- if(i > lines.size()) ++ if(i >= lines.size()) + writeString(String::null, len); + else + writeString(lines[i], len); diff --git a/audio/taglib/patches/patch-tests_CMakeLists_txt b/audio/taglib/patches/patch-tests_CMakeLists_txt index b5d9d0fa49e..467acd14bb9 100644 --- a/audio/taglib/patches/patch-tests_CMakeLists_txt +++ b/audio/taglib/patches/patch-tests_CMakeLists_txt @@ -1,9 +1,16 @@ -$OpenBSD: patch-tests_CMakeLists_txt,v 1.2 2012/10/01 07:31:17 dcoppa Exp $ ---- tests/CMakeLists.txt.orig Fri Sep 28 14:19:44 2012 -+++ tests/CMakeLists.txt Fri Sep 28 14:20:02 2012 -@@ -1,4 +1,5 @@ - INCLUDE_DIRECTORIES( -+ ${CPPUNIT_INCLUDE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/../taglib - ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/toolkit - ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/ape +$OpenBSD: patch-tests_CMakeLists_txt,v 1.3 2012/10/10 10:51:02 dcoppa Exp $ + +Add missing CppUnit include directive +(upstream git commit 72f9a96cceba0e22a672760961de3a87e291a602) + +--- tests/CMakeLists.txt.orig Thu Sep 6 20:03:15 2012 ++++ tests/CMakeLists.txt Wed Oct 10 12:23:55 2012 +@@ -62,6 +62,8 @@ SET(test_runner_SRCS + test_mpc.cpp + ) + ++INCLUDE_DIRECTORIES(${CPPUNIT_INCLUDE_DIR}) ++ + ADD_EXECUTABLE(test_runner ${test_runner_SRCS}) + TARGET_LINK_LIBRARIES(test_runner tag ${CPPUNIT_LIBRARIES}) +