new package: timidity++

This commit is contained in:
Tee KOBAYASHI 2022-04-18 07:34:09 +09:00 committed by xtkoba
parent 2d5ac8622f
commit 7730ec0844
6 changed files with 207 additions and 0 deletions

View File

@ -0,0 +1,31 @@
From 2386ec2c745f6c5075e53ea051da211336b44b84 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Tue, 26 Jun 2018 22:31:27 +0200
Subject: readmidi: Fix division by zero
References: CVE-2017-11546
An adhoc fix for division by zero in insert_note_steps().
Signed-off-by: Takashi Iwai <tiwai@suse.de>
bug-debian: https://bugs.debian.org/870338
bug-suse: https://bugzilla.suse.com/show_bug.cgi?id=1081694
bug: https://bugzilla.suse.com/show_bug.cgi?id=1081694
origin: https://bugzilla.suse.com/attachment.cgi?id=760825
---
timidity/readmidi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/timidity/readmidi.c b/timidity/readmidi.c
index 158388a..341777e 100644
--- a/timidity/readmidi.c
+++ b/timidity/readmidi.c
@@ -4585,6 +4585,8 @@ static void insert_note_steps(void)
if (beat != 0)
meas++, beat = 0;
num = timesig[n].a, denom = timesig[n].b, n++;
+ if (!denom)
+ denom = 1;
}
a = (meas + 1) & 0xff;
b = (((meas + 1) >> 8) & 0x0f) + ((beat + 1) << 4);

View File

@ -0,0 +1,67 @@
From 34328d22cbb4ccf03f29223f54f1834c796d86a2 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Tue, 26 Jun 2018 22:31:28 +0200
Subject: resample: Fix out-of-bound access in resamplers
References: CVE-2017-11547
An adhoc fix for out-of-bound accesses in resamples.
The offset might overflow the given data range.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
bug-debian: https://bugs.debian.org/870338
bug-suse: https://bugzilla.suse.com/show_bug.cgi?id=1081694
origin: https://bugzilla.suse.com/attachment.cgi?id=760826
---
timidity/resample.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/timidity/resample.c b/timidity/resample.c
index cd6b8e6..4a3fadf 100644
--- a/timidity/resample.c
+++ b/timidity/resample.c
@@ -57,6 +57,8 @@ static resample_t resample_cspline(sample_t *src, splen_t ofs, resample_rec_t *r
{
int32 ofsi, ofsf, v0, v1, v2, v3, temp;
+ if (ofs + (1 << FRACTION_BITS) >= rec->data_length)
+ return src[ofs >> FRACTION_BITS];
ofsi = ofs >> FRACTION_BITS;
v1 = src[ofsi];
v2 = src[ofsi + 1];
@@ -96,6 +98,8 @@ static resample_t resample_lagrange(sample_t *src, splen_t ofs, resample_rec_t *
{
int32 ofsi, ofsf, v0, v1, v2, v3;
+ if (ofs + (1 << FRACTION_BITS) >= rec->data_length)
+ return src[ofs >> FRACTION_BITS];
ofsi = ofs >> FRACTION_BITS;
v1 = (int32)src[ofsi];
v2 = (int32)src[ofsi + 1];
@@ -154,6 +158,8 @@ static resample_t resample_gauss(sample_t *src, splen_t ofs, resample_rec_t *rec
sample_t *sptr;
int32 left, right, temp_n;
+ if (ofs + (1 << FRACTION_BITS) >= rec->data_length)
+ return src[ofs >> FRACTION_BITS];
left = (ofs>>FRACTION_BITS);
right = (rec->data_length>>FRACTION_BITS) - left - 1;
temp_n = (right<<1)-1;
@@ -261,6 +267,8 @@ static resample_t resample_newton(sample_t *src, splen_t ofs, resample_rec_t *re
int32 left, right, temp_n;
int ii, jj;
+ if (ofs + (1 << FRACTION_BITS) >= rec->data_length)
+ return src[ofs >> FRACTION_BITS];
left = (ofs>>FRACTION_BITS);
right = (rec->data_length>>FRACTION_BITS)-(ofs>>FRACTION_BITS)-1;
temp_n = (right<<1)-1;
@@ -330,6 +338,8 @@ static resample_t resample_linear(sample_t *src, splen_t ofs, resample_rec_t *re
{
int32 v1, v2, ofsi;
+ if (ofs + (1 << FRACTION_BITS) >= rec->data_length)
+ return src[ofs >> FRACTION_BITS];
ofsi = ofs >> FRACTION_BITS;
v1 = src[ofsi];
v2 = src[ofsi + 1];

View File

@ -0,0 +1,39 @@
TERMUX_PKG_HOMEPAGE=http://timidity.sourceforge.net/
TERMUX_PKG_DESCRIPTION="MIDI-to-WAVE converter and player"
TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=2.15.0
TERMUX_PKG_SRCURL=https://downloads.sourceforge.net/timidity/TiMidity++-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=9eaf4fadb0e19eb8e35cd4ac16142d604c589e43d0e8798237333697e6381d39
TERMUX_PKG_CONFFILES="
share/timidity/timidity.cfg
"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
--enable-dynamic
--enable-vt100
--enable-server
--enable-network
--with-module-dir=$TERMUX_PREFIX/share/timidity
lib_cv_va_copy=yes
lib_cv___va_copy=yes
lib_cv_va_val_copy=yes
"
termux_step_pre_configure() {
autoreconf -fi
}
termux_step_post_configure() {
mkdir -p _build
$CC_FOR_BUILD $TERMUX_PKG_SRCDIR/timidity/calcnewt.c \
-o _build/calcnewt -lm
export PATH="$(pwd)/_build:$PATH"
ln -sf $TERMUX_PKG_SRCDIR/timidity/resample.c timidity/
}
termux_step_post_make_install() {
sed "s:@TERMUX_PREFIX@:$TERMUX_PREFIX:g" \
$TERMUX_PKG_BUILDER_DIR/timidity.cfg > timidity.cfg
install -Dm600 -t $TERMUX_PREFIX/share/timidity timidity.cfg
}

View File

@ -0,0 +1,11 @@
--- a/timidity/Makefile.am
+++ b/timidity/Makefile.am
@@ -460,7 +460,7 @@
else
newton_table.c: calcnewt$(EXEEXT)
- ./calcnewt > $@
+ calcnewt > $@
endif
endif

View File

@ -0,0 +1,11 @@
--- a/timidity/common.c
+++ b/timidity/common.c
@@ -192,7 +192,7 @@
tmpdir = getenv("TMPDIR");
#endif
if(tmpdir == NULL || strlen(tmpdir) == 0)
- tmpdir = PATH_STRING "tmp" PATH_STRING;
+ tmpdir = "@TERMUX_PREFIX@/tmp/";
if(IS_PATH_SEP(tmpdir[strlen(tmpdir) - 1]))
snprintf(filename, sizeof(filename), "%sXXXXXX.%s", tmpdir, ext);
else

View File

@ -0,0 +1,48 @@
# Copyright: 1996 Klee Dienes <klee@debian.org>
# 1997-2002 Martin Mitchell <martin@debian.org>
# 2003-2005 Henrique de Moraes Holschuh <hmh@debian.org>
# 2007-2010 Joost Yervante Damad <andete@debian.org>
# 2018 Reiner Herrmann <reiner@reiner-h.de>
# License: GPL-2+
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any
# later version.
# Instrument configuration file for timidity
# $Id: timidity.cfg,v 1.7 2005/09/03 19:26:03 hmh Exp $
# You can change just about every option in TiMidity++ using
# This config file. Please refer to the timidity.cfg(5) manpage
# for more details
## If you have a slow CPU, uncomment these:
#opt EFresamp=d #disable resampling
#opt EFvlpf=d #disable VLPF
#opt EFreverb=d #disable reverb
#opt EFchorus=d #disable chorus
#opt EFdelay=d #disable delay
#opt anti-alias=d #disable sample anti-aliasing
#opt EWPVSETOZ #disable all Midi Controls
#opt p32a #default to 32 voices with auto reduction
#opt s32kHz #default sample frequency to 32kHz
#opt fast-decay #fast decay notes
## If you have a moderate CPU, try these:
#opt EFresamp=l
#opt EFreverb=g,42
#opt EFchorus=s
#opt s32kHz
#opt p64a
# Disabling some of the Midi Controls can help with the CPU usage a lot.
# The same goes to the VLPF, sample anti-aliasing and effects such as
# reverb and chorus
# By default, try to use the instrument patches from freepats:
#source @TERMUX_PREFIX@/share/timidity/freepats.cfg
# alternatively, you can use the fluid-soundfont:
#source @TERMUX_PREFIX@/share/timidity/fluidr3_gm.cfg
#source @TERMUX_PREFIX@/share/timidity/fluidr3_gs.cfg