From 380ee87e800e44b5e930d784dfb8aeadddf637f3 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 5 Jan 2018 16:27:19 -0300 Subject: [PATCH] Fixed problem with missing uninitialized last byte on waveform trip, closes #15316 --- drivers/windows/file_access_windows.cpp | 1 + editor/import/resource_importer_wav.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp index 409ca52ae02..dbffac8ebd8 100644 --- a/drivers/windows/file_access_windows.cpp +++ b/drivers/windows/file_access_windows.cpp @@ -190,6 +190,7 @@ uint8_t FileAccessWindows::get_8() const { uint8_t b; if (fread(&b, 1, 1, f) == 0) { check_errors(); + b = '\0'; }; return b; diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp index b964b96addb..f73c7ebfd89 100644 --- a/editor/import/resource_importer_wav.cpp +++ b/editor/import/resource_importer_wav.cpp @@ -387,8 +387,9 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s Vector new_data; new_data.resize((last - first + 1) * format_channels); - for (int i = first * format_channels; i <= last * format_channels; i++) { + for (int i = first * format_channels; i < (last + 1) * format_channels; i++) { new_data[i - first * format_channels] = data[i]; + setc++; } data = new_data;