Fix a possible null pointer dereference.

This commit is contained in:
David Reid
2026-01-07 12:07:58 +10:00
parent bd26454c26
commit 32cc6d53cd
+6 -6
View File
@@ -71529,13 +71529,13 @@ MA_API ma_result ma_resource_manager_data_buffer_get_data_format(ma_resource_man
MA_API ma_result ma_resource_manager_data_buffer_get_cursor_in_pcm_frames(ma_resource_manager_data_buffer* pDataBuffer, ma_uint64* pCursor) MA_API ma_result ma_resource_manager_data_buffer_get_cursor_in_pcm_frames(ma_resource_manager_data_buffer* pDataBuffer, ma_uint64* pCursor)
{ {
/* We cannot be using the data source after it's been uninitialized. */
MA_ASSERT(ma_resource_manager_data_buffer_node_result(pDataBuffer->pNode) != MA_UNAVAILABLE);
if (pDataBuffer == NULL || pCursor == NULL) { if (pDataBuffer == NULL || pCursor == NULL) {
return MA_INVALID_ARGS; return MA_INVALID_ARGS;
} }
/* We cannot be using the data source after it's been uninitialized. */
MA_ASSERT(ma_resource_manager_data_buffer_node_result(pDataBuffer->pNode) != MA_UNAVAILABLE);
*pCursor = 0; *pCursor = 0;
switch (ma_resource_manager_data_buffer_node_get_data_supply_type(pDataBuffer->pNode)) switch (ma_resource_manager_data_buffer_node_get_data_supply_type(pDataBuffer->pNode))
@@ -71569,13 +71569,13 @@ MA_API ma_result ma_resource_manager_data_buffer_get_cursor_in_pcm_frames(ma_res
MA_API ma_result ma_resource_manager_data_buffer_get_length_in_pcm_frames(ma_resource_manager_data_buffer* pDataBuffer, ma_uint64* pLength) MA_API ma_result ma_resource_manager_data_buffer_get_length_in_pcm_frames(ma_resource_manager_data_buffer* pDataBuffer, ma_uint64* pLength)
{ {
/* We cannot be using the data source after it's been uninitialized. */
MA_ASSERT(ma_resource_manager_data_buffer_node_result(pDataBuffer->pNode) != MA_UNAVAILABLE);
if (pDataBuffer == NULL || pLength == NULL) { if (pDataBuffer == NULL || pLength == NULL) {
return MA_INVALID_ARGS; return MA_INVALID_ARGS;
} }
/* We cannot be using the data source after it's been uninitialized. */
MA_ASSERT(ma_resource_manager_data_buffer_node_result(pDataBuffer->pNode) != MA_UNAVAILABLE);
if (ma_resource_manager_data_buffer_node_get_data_supply_type(pDataBuffer->pNode) == ma_resource_manager_data_supply_type_unknown) { if (ma_resource_manager_data_buffer_node_get_data_supply_type(pDataBuffer->pNode) == ma_resource_manager_data_supply_type_unknown) {
return MA_BUSY; /* Still loading. */ return MA_BUSY; /* Still loading. */
} }