glTF2 exporter buffer overrun issue fix.

pull/4174/head
freizhang 2021-11-13 11:52:49 +08:00
parent fe73213420
commit 1407491a67
1 changed files with 1 additions and 1 deletions

View File

@ -974,7 +974,7 @@ void ExportSkin(Asset &mAsset, const aiMesh *aimesh, Ref<Mesh> &meshRef, Ref<Buf
Ref<Buffer> buf = vertexJointAccessor->bufferView->buffer; Ref<Buffer> buf = vertexJointAccessor->bufferView->buffer;
uint8_t *arrys = new uint8_t[bytesLen]; uint8_t *arrys = new uint8_t[bytesLen];
unsigned int i = 0; unsigned int i = 0;
for (unsigned int j = 0; j <= bytesLen; j += bytesPerComp) { for (unsigned int j = 0; j < bytesLen; j += bytesPerComp) {
size_t len_p = offset + j; size_t len_p = offset + j;
float f_value = *(float *)&buf->GetPointer()[len_p]; float f_value = *(float *)&buf->GetPointer()[len_p];
unsigned short c = static_cast<unsigned short>(f_value); unsigned short c = static_cast<unsigned short>(f_value);