mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-01-28 22:04:43 -08:00
Added patch to check input format in MPEG3_StreamOpen.
This commit is contained in:
parent
d3cebda659
commit
5b67aa1fc3
@ -370,6 +370,7 @@ patch_enable_all ()
|
||||
enable_wined3d_Silence_FIXMEs="$1"
|
||||
enable_winedevice_Fix_Relocation="$1"
|
||||
enable_winemenubuilder_Desktop_Icon_Path="$1"
|
||||
enable_winemp3_acm_MPEG3_StreamOpen="$1"
|
||||
enable_wineps_drv_PostScript_Fixes="$1"
|
||||
enable_winepulse_PulseAudio_Support="$1"
|
||||
enable_winex11_CandidateWindowPos="$1"
|
||||
@ -1283,6 +1284,9 @@ patch_enable ()
|
||||
winemenubuilder-Desktop_Icon_Path)
|
||||
enable_winemenubuilder_Desktop_Icon_Path="$2"
|
||||
;;
|
||||
winemp3.acm-MPEG3_StreamOpen)
|
||||
enable_winemp3_acm_MPEG3_StreamOpen="$2"
|
||||
;;
|
||||
wineps.drv-PostScript_Fixes)
|
||||
enable_wineps_drv_PostScript_Fixes="$2"
|
||||
;;
|
||||
@ -7460,6 +7464,18 @@ if test "$enable_winemenubuilder_Desktop_Icon_Path" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset winemp3.acm-MPEG3_StreamOpen
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/msacm32/tests/msacm.c, dlls/winemp3.acm/mpegl3.c
|
||||
# |
|
||||
if test "$enable_winemp3_acm_MPEG3_StreamOpen" -eq 1; then
|
||||
patch_apply winemp3.acm-MPEG3_StreamOpen/0001-winemp3.acm-Check-input-format-in-MPEG3_StreamOpen.patch
|
||||
(
|
||||
echo '+ { "Michael Müller", "winemp3.acm: Check input format in MPEG3_StreamOpen.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset wineps.drv-PostScript_Fixes
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
|
@ -0,0 +1,138 @@
|
||||
From 46192b44294e309aa90131cd00f44127cbd9a49f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sun, 21 Aug 2016 02:36:47 +0200
|
||||
Subject: winemp3.acm: Check input format in MPEG3_StreamOpen.
|
||||
|
||||
---
|
||||
dlls/msacm32/tests/msacm.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||
dlls/winemp3.acm/mpegl3.c | 15 +++++++++-
|
||||
2 files changed, 85 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/msacm32/tests/msacm.c b/dlls/msacm32/tests/msacm.c
|
||||
index 812a1bb..efe34b1 100644
|
||||
--- a/dlls/msacm32/tests/msacm.c
|
||||
+++ b/dlls/msacm32/tests/msacm.c
|
||||
@@ -826,9 +826,80 @@ todo_wine
|
||||
ok(rc == MMSYSERR_INVALPARAM, "failed with error 0x%x\n", rc);
|
||||
}
|
||||
|
||||
+void test_mp3(void)
|
||||
+{
|
||||
+ MPEGLAYER3WAVEFORMAT src;
|
||||
+ WAVEFORMATEX dst;
|
||||
+ HACMSTREAM has;
|
||||
+ DWORD output;
|
||||
+ MMRESULT mr;
|
||||
+
|
||||
+ src.wfx.wFormatTag = WAVE_FORMAT_MPEGLAYER3;
|
||||
+ src.wfx.nSamplesPerSec = 11025;
|
||||
+ src.wfx.wBitsPerSample = 0;
|
||||
+ src.wfx.nChannels = 1;
|
||||
+ src.wfx.nBlockAlign = 576;
|
||||
+ src.wfx.nAvgBytesPerSec = 2000;
|
||||
+
|
||||
+ src.wID = MPEGLAYER3_ID_MPEG;
|
||||
+ src.fdwFlags = 0;
|
||||
+ src.nBlockSize = 576;
|
||||
+ src.nFramesPerBlock = 1;
|
||||
+ src.nCodecDelay = 0;
|
||||
+
|
||||
+ dst.cbSize = 0;
|
||||
+ dst.wFormatTag = WAVE_FORMAT_PCM;
|
||||
+ dst.nSamplesPerSec = 11025;
|
||||
+ dst.wBitsPerSample = 16;
|
||||
+ dst.nChannels = 1;
|
||||
+ dst.nBlockAlign = dst.wBitsPerSample * dst.nChannels / 8;
|
||||
+ dst.nAvgBytesPerSec = dst.nSamplesPerSec * dst.nBlockAlign;
|
||||
+
|
||||
+ src.wfx.cbSize = 0;
|
||||
+
|
||||
+ mr = acmStreamOpen(&has, NULL, (WAVEFORMATEX*)&src, &dst, NULL, 0, 0, 0);
|
||||
+ ok(mr == ACMERR_NOTPOSSIBLE, "expected error ACMERR_NOTPOSSIBLE, got 0x%x\n", mr);
|
||||
+ if (mr == MMSYSERR_NOERROR) acmStreamClose(has, 0);
|
||||
+
|
||||
+ src.wfx.cbSize = MPEGLAYER3_WFX_EXTRA_BYTES;
|
||||
+ src.wID = 0;
|
||||
+
|
||||
+ mr = acmStreamOpen(&has, NULL, (WAVEFORMATEX*)&src, &dst, NULL, 0, 0, 0);
|
||||
+ ok(mr == ACMERR_NOTPOSSIBLE, "expected error ACMERR_NOTPOSSIBLE, got 0x%x\n", mr);
|
||||
+ if (mr == MMSYSERR_NOERROR) acmStreamClose(has, 0);
|
||||
+
|
||||
+ src.wID = MPEGLAYER3_ID_MPEG;
|
||||
+ src.nBlockSize = 0;
|
||||
+
|
||||
+ mr = acmStreamOpen(&has, NULL, (WAVEFORMATEX*)&src, &dst, NULL, 0, 0, 0);
|
||||
+ ok(mr == MMSYSERR_NOERROR, "failed with error 0x%x\n", mr);
|
||||
+ mr = acmStreamClose(has, 0);
|
||||
+ ok(mr == MMSYSERR_NOERROR, "failed with error 0x%x\n", mr);
|
||||
+
|
||||
+ src.nBlockSize = 576;
|
||||
+ src.wfx.nAvgBytesPerSec = 0;
|
||||
+
|
||||
+ mr = acmStreamOpen(&has, NULL, (WAVEFORMATEX*)&src, &dst, NULL, 0, 0, 0);
|
||||
+ ok(mr == MMSYSERR_NOERROR, "failed with error 0x%x\n", mr);
|
||||
+ /* causes a division by zero exception */
|
||||
+ if (0) acmStreamSize(has, 4000, &output, ACM_STREAMSIZEF_SOURCE);
|
||||
+ mr = acmStreamClose(has, 0);
|
||||
+ ok(mr == MMSYSERR_NOERROR, "failed with error 0x%x\n", mr);
|
||||
+
|
||||
+ src.wfx.nAvgBytesPerSec = 2000;
|
||||
+
|
||||
+ mr = acmStreamOpen(&has, NULL, (WAVEFORMATEX*)&src, &dst, NULL, 0, 0, 0);
|
||||
+ ok(mr == MMSYSERR_NOERROR, "failed with error 0x%x\n", mr);
|
||||
+ mr = acmStreamSize(has, 4000, &output, ACM_STREAMSIZEF_SOURCE);
|
||||
+ ok(mr == MMSYSERR_NOERROR, "failed with error 0x%x\n", mr);
|
||||
+ mr = acmStreamClose(has, 0);
|
||||
+ ok(mr == MMSYSERR_NOERROR, "failed with error 0x%x\n", mr);
|
||||
+}
|
||||
+
|
||||
START_TEST(msacm)
|
||||
{
|
||||
driver_tests();
|
||||
test_prepareheader();
|
||||
test_acmFormatSuggest();
|
||||
+ test_mp3();
|
||||
}
|
||||
diff --git a/dlls/winemp3.acm/mpegl3.c b/dlls/winemp3.acm/mpegl3.c
|
||||
index 37993b4..b6595e6 100644
|
||||
--- a/dlls/winemp3.acm/mpegl3.c
|
||||
+++ b/dlls/winemp3.acm/mpegl3.c
|
||||
@@ -215,6 +215,7 @@ static void MPEG3_Reset(PACMDRVSTREAMINSTANCE adsi, AcmMpeg3Data* aad)
|
||||
*/
|
||||
static LRESULT MPEG3_StreamOpen(PACMDRVSTREAMINSTANCE adsi)
|
||||
{
|
||||
+ LRESULT error = MMSYSERR_NOTSUPPORTED;
|
||||
AcmMpeg3Data* aad;
|
||||
int err;
|
||||
|
||||
@@ -238,6 +239,18 @@ static LRESULT MPEG3_StreamOpen(PACMDRVSTREAMINSTANCE adsi)
|
||||
adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_MPEG) &&
|
||||
adsi->pwfxDst->wFormatTag == WAVE_FORMAT_PCM)
|
||||
{
|
||||
+ if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_MPEGLAYER3)
|
||||
+ {
|
||||
+ MPEGLAYER3WAVEFORMAT *formatmp3 = (MPEGLAYER3WAVEFORMAT *)adsi->pwfxSrc;
|
||||
+
|
||||
+ if (adsi->pwfxSrc->cbSize < MPEGLAYER3_WFX_EXTRA_BYTES ||
|
||||
+ formatmp3->wID != MPEGLAYER3_ID_MPEG)
|
||||
+ {
|
||||
+ error = ACMERR_NOTPOSSIBLE;
|
||||
+ goto theEnd;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/* resampling or mono <=> stereo not available
|
||||
* MPEG3 algo only define 16 bit per sample output
|
||||
*/
|
||||
@@ -261,7 +274,7 @@ static LRESULT MPEG3_StreamOpen(PACMDRVSTREAMINSTANCE adsi)
|
||||
theEnd:
|
||||
HeapFree(GetProcessHeap(), 0, aad);
|
||||
adsi->dwDriver = 0L;
|
||||
- return MMSYSERR_NOTSUPPORTED;
|
||||
+ return error;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
--
|
||||
2.9.0
|
||||
|
1
patches/winemp3.acm-MPEG3_StreamOpen/definition
Normal file
1
patches/winemp3.acm-MPEG3_StreamOpen/definition
Normal file
@ -0,0 +1 @@
|
||||
Fixes: Check input format in MPEG3_StreamOpen
|
Loading…
x
Reference in New Issue
Block a user