Commit e7940394 authored by David Reid's avatar David Reid

Fix some bugs with trying to access uninitialized variables.

parent d6864c5a
/*
Audio playback and capture library. Choice of public domain or MIT-0. See license statements at the end of this file.
miniaudio - v0.10.26 - 2020-11-24
miniaudio - v0.10.27 - TBD
David Reid - mackron@gmail.com
......@@ -1447,7 +1447,7 @@ extern "C" {
#define MA_VERSION_MAJOR 0
#define MA_VERSION_MINOR 10
#define MA_VERSION_REVISION 26
#define MA_VERSION_REVISION 27
#define MA_VERSION_STRING MA_XSTRINGIFY(MA_VERSION_MAJOR) "." MA_XSTRINGIFY(MA_VERSION_MINOR) "." MA_XSTRINGIFY(MA_VERSION_REVISION)
#if defined(_MSC_VER) && !defined(__clang__)
......@@ -42869,6 +42869,18 @@ MA_API ma_result ma_data_source_get_data_format(ma_data_source* pDataSource, ma_
ma_uint32 sampleRate;
ma_data_source_callbacks* pCallbacks = (ma_data_source_callbacks*)pDataSource;
if (pFormat != NULL) {
*pFormat = ma_format_unknown;
}
if (pChannels != NULL) {
*pChannels = 0;
}
if (pSampleRate != NULL) {
*pSampleRate = 0;
}
if (pCallbacks == NULL || pCallbacks->onGetDataFormat == NULL) {
return MA_INVALID_ARGS;
}
......@@ -64249,6 +64261,9 @@ The following miscellaneous changes have also been made.
/*
REVISION HISTORY
================
v0.10.27 - TBD
- Fix some bugs with trying to access uninitialized variables.
v0.10.26 - 2020-11-24
- WASAPI: Fix a bug where the exclusive mode format may not be retrieved correctly due to accessing freed memory.
- Fix a bug with ma_waveform where glitching occurs after changing frequency.
......@@ -3621,11 +3621,15 @@ static ma_result ma_rb_data_source_init(ma_rb* pRB, ma_format format, ma_uint32
return MA_INVALID_ARGS;
}
MA_ZERO_OBJECT(pDataSource); /* For safety. */
pDataSource->ds.onRead = NULL;
pDataSource->ds.onSeek = NULL; /* We can't really seek in a ring buffer - there's no notion of a beginning and an end in a ring buffer. */
pDataSource->ds.onMap = ma_rb_data_source__on_map;
pDataSource->ds.onUnmap = ma_rb_data_source__on_unmap;
pDataSource->ds.onGetDataFormat = ma_rb_data_source__on_get_format;
pDataSource->ds.onGetCursor = NULL;
pDataSource->ds.onGetLength = NULL;
pDataSource->pRB = pRB;
pDataSource->format = format;
pDataSource->channels = channels;
......@@ -6149,6 +6153,14 @@ MA_API ma_result ma_resource_manager_data_stream_get_data_format(ma_resource_man
/* We cannot be using the data source after it's been uninitialized. */
MA_ASSERT(pDataStream->result != MA_UNAVAILABLE);
if (pFormat != NULL) {
*pFormat = ma_format_unknown;
}
if (pChannels != NULL) {
*pChannels = 0;
}
if (pDataStream == NULL) {
return MA_INVALID_ARGS;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment