Godot Engine – Multi-platform 2D and 3D game engine
Fix LipO crash when binary size aligned with page size.
Pāvels Nadtočajevs3ce688995709
diff --git a/core/io/file_access_packed_byte_array.cpp b/core/io/file_access_packed_byte_array.cppindex 9d0c5f593dd..ee571a4755c 100644--- a/core/io/file_access_packed_byte_array.cpp+++ b/core/io/file_access_packed_byte_array.cpp@@ -60,6 +60,9 @@ bool FileAccessPackedByteArray::eof_reached() const {uint64_t FileAccessPackedByteArray::get_buffer(uint8_t *p_dst, uint64_t p_length) const {ERR_FAIL_NULL_V(p_dst, -1);+ if (!p_length) {+ return 0;+ }uint64_t left = data.size() - pos;uint64_t read = MIN(p_length, left);diff --git a/editor/export/lipo.cpp b/editor/export/lipo.cppindex 4945b1e307f..e9968140437 100644--- a/editor/export/lipo.cpp+++ b/editor/export/lipo.cpp@@ -153,9 +153,11 @@ bool LipO::_create_file(const String &p_output_path, const Vector<Ref<FileAccessfa->store_buffer(step, br);}}- uint64_t br = p_files[i]->get_buffer(step, remain);- if (br > 0) {- fa->store_buffer(step, br);+ if (remain > 0) {+ uint64_t br = p_files[i]->get_buffer(step, remain);+ if (br > 0) {+ fa->store_buffer(step, br);+ }}}return true;@@ -278,9 +280,11 @@ bool LipO::extract_arch(int p_index, const String &p_path) {fb->store_buffer(step, br);}}- uint64_t br = fa->get_buffer(step, remain);- if (br > 0) {- fb->store_buffer(step, br);+ if (remain > 0) {+ uint64_t br = fa->get_buffer(step, remain);+ if (br > 0) {+ fb->store_buffer(step, br);+ }}return true;}