wavpack: don't use "isp" before initialization
The old code called can_seek() with the uninitialized pointer "isp.is". Has this ever worked? Anyway, initialize "isp" first, then call can_seek(&isp).
This commit is contained in:
parent
2e822a577d
commit
cf139dc012
@ -507,15 +507,12 @@ static int wavpack_streamdecode(struct decoder * decoder, InputStream *is)
|
|||||||
InputStream is_wvc;
|
InputStream is_wvc;
|
||||||
int open_flags = OPEN_2CH_MAX | OPEN_NORMALIZE /*| OPEN_STREAMING*/;
|
int open_flags = OPEN_2CH_MAX | OPEN_NORMALIZE /*| OPEN_STREAMING*/;
|
||||||
InputStreamPlus isp, isp_wvc;
|
InputStreamPlus isp, isp_wvc;
|
||||||
int canseek;
|
|
||||||
|
|
||||||
if (wavpack_open_wvc(decoder, &is_wvc)) {
|
if (wavpack_open_wvc(decoder, &is_wvc)) {
|
||||||
initInputStreamPlus(&isp_wvc, decoder, &is_wvc);
|
initInputStreamPlus(&isp_wvc, decoder, &is_wvc);
|
||||||
open_flags |= OPEN_WVC;
|
open_flags |= OPEN_WVC;
|
||||||
}
|
}
|
||||||
|
|
||||||
canseek = can_seek(&isp);
|
|
||||||
|
|
||||||
initInputStreamPlus(&isp, decoder, is);
|
initInputStreamPlus(&isp, decoder, is);
|
||||||
wpc = WavpackOpenFileInputEx(&mpd_is_reader, &isp, &isp_wvc, error,
|
wpc = WavpackOpenFileInputEx(&mpd_is_reader, &isp, &isp_wvc, error,
|
||||||
open_flags, 15);
|
open_flags, 15);
|
||||||
@ -525,7 +522,7 @@ static int wavpack_streamdecode(struct decoder * decoder, InputStream *is)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
wavpack_decode(decoder, wpc, canseek, NULL);
|
wavpack_decode(decoder, wpc, can_seek(&isp), NULL);
|
||||||
|
|
||||||
WavpackCloseFile(wpc);
|
WavpackCloseFile(wpc);
|
||||||
if (open_flags & OPEN_WVC)
|
if (open_flags & OPEN_WVC)
|
||||||
|
Loading…
Reference in New Issue
Block a user