From 4a2e9ca1d72056d2cbfa1bd5ee7f5c153a7e30a8 Mon Sep 17 00:00:00 2001 From: Tee KOBAYASHI Date: Sat, 5 Mar 2022 15:32:17 +0900 Subject: [PATCH] new package: mplayer --- packages/mplayer/build.sh | 36 +++++++++++++++++++ packages/mplayer/command.c.patch | 11 ++++++ packages/mplayer/configure.patch | 11 ++++++ .../mplayer/libmpcodecs-vf_fixpts.c.patch | 19 ++++++++++ .../mplayer/mplayer-1.4-CVE-2016-4352.patch | 24 +++++++++++++ 5 files changed, 101 insertions(+) create mode 100644 packages/mplayer/build.sh create mode 100644 packages/mplayer/command.c.patch create mode 100644 packages/mplayer/configure.patch create mode 100644 packages/mplayer/libmpcodecs-vf_fixpts.c.patch create mode 100644 packages/mplayer/mplayer-1.4-CVE-2016-4352.patch diff --git a/packages/mplayer/build.sh b/packages/mplayer/build.sh new file mode 100644 index 000000000..54435c2d0 --- /dev/null +++ b/packages/mplayer/build.sh @@ -0,0 +1,36 @@ +TERMUX_PKG_HOMEPAGE=https://mplayerhq.hu/ +TERMUX_PKG_DESCRIPTION="The Movie Player" +TERMUX_PKG_LICENSE="GPL-2.0" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=1.4 +TERMUX_PKG_SRCURL=https://ftp-osl.osuosl.org/pub/gentoo/distfiles/MPlayer-${TERMUX_PKG_VERSION}.tar.xz +TERMUX_PKG_SHA256=82596ed558478d28248c7bc3828eb09e6948c099bbd76bb7ee745a0e3275b548 +TERMUX_PKG_DEPENDS="ffmpeg, libbz2, ncurses, zlib" +TERMUX_PKG_BUILD_IN_SRC=true +TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" +--disable-ffmpeg_a +--disable-vidix +--disable-gl +" +TERMUX_PKG_EXTRA_MAKE_ARGS="INSTALLSTRIP=" +TERMUX_PKG_BLACKLISTED_ARCHES="i686" + +termux_step_post_get_source() { + termux_download \ + "https://github.com/gentoo/gentoo/raw/a3045b07e451738d566af36b38e96dbf76d8659c/media-video/mplayer/files/ffmpeg44.patch" \ + $TERMUX_PKG_CACHEDIR/mplayer-ffmpeg44.patch \ + eb796b380f9ed9a6a68ee523493dce5f27fc57b8c0dea0d44a13752ec7411fcd + cat $TERMUX_PKG_CACHEDIR/mplayer-ffmpeg44.patch | patch --silent -p1 + termux_download \ + "https://dev.gentoo.org/~aballier/distfiles/mplayer-1.4-ffmpeg5.patch.bz2" \ + $TERMUX_PKG_CACHEDIR/mplayer-1.4-ffmpeg5.patch.bz2 \ + 3397eb50fe7265dc435f6df824cd6153440c14029c8a0be76056ae89733970db + bzcat $TERMUX_PKG_CACHEDIR/mplayer-1.4-ffmpeg5.patch.bz2 | patch --silent -p1 +} + +termux_step_configure_autotools() { + sh "$TERMUX_PKG_SRCDIR/configure" \ + --target=$TERMUX_HOST_PLATFORM \ + --prefix=$TERMUX_PREFIX \ + $TERMUX_PKG_EXTRA_CONFIGURE_ARGS +} diff --git a/packages/mplayer/command.c.patch b/packages/mplayer/command.c.patch new file mode 100644 index 000000000..7f72682c6 --- /dev/null +++ b/packages/mplayer/command.c.patch @@ -0,0 +1,11 @@ +--- a/command.c ++++ b/command.c +@@ -3375,7 +3375,7 @@ + if (!fork()) { + char *exp_cmd = property_expand_string(mpctx, cmd->args[0].v.s); + if (exp_cmd) { +- execl("/bin/sh", "sh", "-c", exp_cmd, NULL); ++ execl("@TERMUX_PREFIX@/bin/sh", "sh", "-c", exp_cmd, NULL); + free(exp_cmd); + } + exit(0); diff --git a/packages/mplayer/configure.patch b/packages/mplayer/configure.patch new file mode 100644 index 000000000..a9cb2add7 --- /dev/null +++ b/packages/mplayer/configure.patch @@ -0,0 +1,11 @@ +--- a/configure ++++ b/configure +@@ -2861,7 +2861,7 @@ + fi + + CFLAGS="-D_ISOC99_SOURCE -I. -Iffmpeg $CFLAGS" +-HOSTCFLAGS="-D_ISOC99_SOURCE -I. -Iffmpeg -O3" ++HOSTCFLAGS="-D_ISOC99_SOURCE -I. -Iffmpeg -idirafter @TERMUX_PREFIX@/include -O3" + + # On glibc, add some more CPPFLAGS for enabling required functionality. + cpp_condition_check features.h "defined __GLIBC__" && diff --git a/packages/mplayer/libmpcodecs-vf_fixpts.c.patch b/packages/mplayer/libmpcodecs-vf_fixpts.c.patch new file mode 100644 index 000000000..23f1c1088 --- /dev/null +++ b/packages/mplayer/libmpcodecs-vf_fixpts.c.patch @@ -0,0 +1,19 @@ +--- a/libmpcodecs/vf_fixpts.c ++++ b/libmpcodecs/vf_fixpts.c +@@ -103,7 +103,7 @@ + return 1; + } + +-static int open(vf_instance_t *vf, char *args) ++static int vf_open(vf_instance_t *vf, char *args) + { + struct vf_priv_s *p; + struct vf_priv_s ptmp = { +@@ -132,6 +132,6 @@ + "fixpts", + "Nicolas George", + "", +- &open, ++ &vf_open, + NULL + }; diff --git a/packages/mplayer/mplayer-1.4-CVE-2016-4352.patch b/packages/mplayer/mplayer-1.4-CVE-2016-4352.patch new file mode 100644 index 000000000..743d73490 --- /dev/null +++ b/packages/mplayer/mplayer-1.4-CVE-2016-4352.patch @@ -0,0 +1,24 @@ +https://nvd.nist.gov/vuln/detail/CVE-2016-4352 +https://www.openwall.com/lists/oss-security/2016/04/29/7 +https://trac.mplayerhq.hu/ticket/2295 + +--- a/libmpdemux/demux_gif.c ++++ b/libmpdemux/demux_gif.c +@@ -316,6 +316,17 @@ + return NULL; + } + ++ // Validate image size, most code in this demuxer assumes w*h <= INT_MAX ++ if ((int64_t)gif->SWidth * gif->SHeight > INT_MAX) { ++ mp_msg(MSGT_DEMUX, MSGL_ERR, ++ "[demux_gif] Unsupported picture size %dx%d.\n", gif->SWidth, ++ gif->SHeight); ++ if (DGifCloseFile(gif) == GIF_ERROR) ++ print_gif_error(NULL); ++ free(priv); ++ return NULL; ++ } ++ + // create a new video stream header + sh_video = new_sh_video(demuxer, 0); +