8000 [pull] master from syoyo:master by pull[bot] · Pull Request #8 · Mu-L/tinygltf · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[pull] master from syoyo:master #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
46ee8b4
GLB: Fix interger-overflow when calculating JSON Chunk size.
syoyo Aug 26, 2022
69eeea1
Auto detect C++14 standard version
zbendefy Sep 5, 2022
64452bb
Merge pull request #377 from zbendefy/master
syoyo Sep 6, 2022
966a9d0
Merge pull request #374 from syoyo/glb_chunk_check
syoyo Sep 6, 2022
4581d37
v2.6.1
syoyo Sep 6, 2022
e413216
Fix possible out of bounds index in LoadFromString
nirmal Sep 6, 2022
0cc2335
Merge pull request #379 from nirmal/patch-1
syoyo Sep 6, 2022
4317223
Fixes compiler warning on VS (Unreachable code detected)
AlvaroBarua Sep 10, 2022
c7e911c
Merge pull request #380 from AlvaroBarua/master
syoyo Sep 11, 2022
eec4c98
Add note on v2.6.2(Fix out-of-bounds access of accessors. PR#379)
syoyo Sep 16, 2022
c670f08
Fix parsing GLB file with empty Chunk1(BIN data).
syoyo Sep 17, 2022
6b7ec9f
added tests to cover empty, empty buffer, and single byte buffer cases
Kh4n Sep 17, 2022
6514490
update gitignore to remove test file
Kh4n Sep 17, 2022
387fd61
update test to match gltf-validator
Kh4n Sep 17, 2022
a778c08
readd toplevel makefile
Kh4n Sep 17, 2022
612e578
Fix handling <4 byte BIN data.
syoyo Sep 18, 2022
e9fbc03
Clear error/warn message.
syoyo Sep 18, 2022
18450ea
Merge pull request #382 from syoyo/glb-zero-chunk
syoyo Sep 18, 2022
e0b6255
v2.6.3
syoyo Sep 18, 2022
6e8a858
Add WASI build procedure.
syoyo Sep 21, 2022
1668d1e
Fix UTF-8 filepath on LLVM MinGW
operatios Sep 24, 2022
9bb5806
Merge pull request #385 from operatios/master
syoyo Sep 24, 2022
56e1098
Fix various type mismatches and header include case (fixes compile wa…
geometrian Oct 7, 2022
d9ce9eb
Fix a gazillion typos.
geometrian Oct 7, 2022
3a29588
Patch to fix previous commit for MinGW.
geometrian Oct 7, 2022
091a1fc
Merge pull request #386 from geometrian/master
syoyo Oct 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,11 @@ loader_example
tests/tester
tests/tester_noexcept
tests/issue-97.gltf
tests/issue-261.gltf

# unignore
!Makefile
!examples/build-gltf/Makefile
!examples/raytrace/cornellbox_suzanne.obj
!tests/Makefile
!tools/windows/premake5.exe
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ In extension(`ExtensionMap`), JSON number value is parsed as int or float(number
* [basic](examples/basic) : Basic glTF viewer with texturing support.
* [build-gltf](examples/build-gltf) : Build simple glTF scene from a scratch.

### WASI/WASM build

Users who want to run TinyGLTF securely and safely(e.g. need to handle malcious glTF file to serve online glTF conver),
I recommend to build TinyGLTF for WASM target.
WASI build example is located in [wasm](wasm) .

## Projects using TinyGLTF

* px_render Single header C++ Libraries for Thread Scheduling, Rendering, and so on... https://github.com/pplux/px
Expand Down
58 changes: 58 additions & 0 deletions tests/tester.cc
Original file line number Diff line number Diff line change
Expand Up @@ -482,3 +482,61 @@ TEST_CASE("expandpath-utf-8", "[pr-226]") {

}
#endif

TEST_CASE("empty-bin-buffer", "[issue-382]") {
tinygltf::Model model;
tinygltf::TinyGLTF ctx;
std::string err;
std::string warn;

tinygltf::Model model_empty;
std::stringstream stream;
bool ret = ctx.WriteGltfSceneToStream(&model_empty, stream, false, true);
REQUIRE(ret == true);
std::string str = stream.str();
const unsigned char* bytes = (unsigned char*)str.data();
ret = ctx.LoadBinaryFromMemory(&model, &err, &warn, bytes, str.size());
if (!err.empty()) {
std::cerr << err << std::endl;
}
REQUIRE(true == ret);

err.clear();
warn.clear();

tinygltf::Model model_empty_buffer;
model_empty_buffer.buffers.push_back(tinygltf::Buffer());
stream = std::stringstream();
ret = ctx.WriteGltfSceneToStream(&model_empty_buffer, stream, false, true);
REQUIRE(ret == true);
str = stream.str();
bytes = (unsigned char*)str.data();
ret = ctx.LoadBinaryFromMemory(&model, &err, &warn, bytes, str.size());
if (err.empty()) {
std::cerr << "there should have been an error reported" << std::endl;
}
REQUIRE(false == ret);

err.clear();
warn.clear();

tinygltf::Model model_single_byte_buffer;
tinygltf::Buffer buffer;
buffer.data.push_back(0);
model_single_byte_buffer.buffers.push_back(buffer);
stream = std::stringstream();
ret = ctx.WriteGltfSceneToStream(&model_single_byte_buffer, stream, false, true);
REQUIRE(ret == true);
str = stream.str();
{
std::ofstream ofs("tmp.glb");
ofs.write(str.data(), str.size());
}

bytes = (unsigned char*)str.data();
ret = ctx.LoadBinaryFromMemory(&model_single_byte_buffer, &err, &warn, bytes, str.size());
if (!err.empty()) {
std::cerr << err << std::endl;
}
REQUIRE(true == ret);
}
Loading
0