FVoiceCaptureWindows::GetVoiceData crashes when buffer too small

There is a 'check` that probably shouldn’t be there at the end of the method:

EVoiceCaptureState::Type FVoiceCaptureWindows::GetVoiceData(uint8* OutVoiceBuffer, const uint32 InVoiceBufferSize, uint32& OutBytesWritten, uint64& OutSampleClockCounter)
	EVoiceCaptureState::Type NewMicState = VoiceCaptureState;
	OutBytesWritten = 0;

	if (VoiceCaptureState == EVoiceCaptureState::Ok ||
		VoiceCaptureState == EVoiceCaptureState::Stopping)

		if (InVoiceBufferSize >= (uint32) UncompressedAudioBuffer.Num())
			OutBytesWritten = UncompressedAudioBuffer.Num();
			FMemory::Memcpy(OutVoiceBuffer, UncompressedAudioBuffer.GetData(), OutBytesWritten);
			VoiceCaptureState = EVoiceCaptureState::NoData;

			OutSampleClockCounter = CurrentSampleStart;
			NewMicState = EVoiceCaptureState::BufferTooSmall;
	check(OutBytesWritten > 0);
	return NewMicState;

If the buffer is too small, it will trigger the assert in development builds.


We’ve recently made a switch to a new bug reporting method using a more structured form. Please visit the link below for more details and report the issue using the new Bug Submission Form. Feel free to continue to use this thread for community discussion around the issue.



Hi, did you ever find a resolution to this issue mate?