Skip to content
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

Draco: memory access out of bounds #928

Closed
marwie opened this issue Apr 28, 2023 · 7 comments
Closed

Draco: memory access out of bounds #928

marwie opened this issue Apr 28, 2023 · 7 comments
Labels
bug Something isn't working package:extensions

Comments

@marwie
Copy link
Contributor

marwie commented Apr 28, 2023

Describe the bug
compressing the attached glb results in a RuntimeError: memory access out of bounds error

To Reproduce
Steps to reproduce the behavior:

  1. run `gltf-transform draco "path/to/glb" "some/output/path"
  2. observe error

Expected behavior
Mesh should be compressed, no errors

Versions:

  • Version: 2.5.1 but seems to reproduce on 3.x
  • Environment: node 18.15.0

Additional context
MyMesh.zip

                                                                                                                                                   
                                                                                                                                                   
g: memory access out of bounds                                                                                                                     
    at Se.run (C:\Users\...\AppData\Roaming\npm\node_modules\@gltf-transform\cli\node_modules\@caporal\core\dist\index.js:1:27764)               
    at async Te._run (C:\Users\...\AppData\Roaming\npm\node_modules\@gltf-transform\cli\node_modules\@caporal\core\dist\index.js:1:32257) {      
  meta: {                                                                                                                                          
    error: RuntimeError: memory access out of bounds                                                                                               
        at wasm://wasm/0017a2d6:wasm-function[344]:0x3e869                                                                                         
        at wasm://wasm/0017a2d6:wasm-function[200]:0x16f68                                                                                         
        at wasm://wasm/0017a2d6:wasm-function[588]:0x586dd                                                                                         
        at wasm://wasm/0017a2d6:wasm-function[390]:0x41f99                                                                                         
        at wasm://wasm/0017a2d6:wasm-function[599]:0x59f5f                                                                                         
        at wasm://wasm/0017a2d6:wasm-function[601]:0x5a028                                                                                         
        at wasm://wasm/0017a2d6:wasm-function[471]:0x47b02                                                                                         
        at wasm://wasm/0017a2d6:wasm-function[473]:0x48558                                                                                         
        at wasm://wasm/0017a2d6:wasm-function[297]:0x37760                                                                                         
        at wasm://wasm/0017a2d6:wasm-function[201]:0x22a01                                                                                         
  }                                                                                                                                                
}                                                                                                                                                  
@marwie marwie added the bug Something isn't working label Apr 28, 2023
@donmccurdy
Copy link
Owner

I'm AFK for a bit, but do you mind testing whether this works with glTF Pipeline? I've seen this issue in the past and think it might be a Draco library issue, if it fails in glTF Pipeline as well that's a good sign it's Draco.

@marwie
Copy link
Contributor Author

marwie commented Apr 30, 2023

Hi @donmccurdy it runs fine with gltf-pipeline

MyMesh-o.zip

image

image

@marwie
Copy link
Contributor Author

marwie commented Apr 30, 2023

I also tried with gltf-transform 3.2.1 again and get:

λ gltf-transform draco Downloads\MyMesh.glb Downloads\MyMesh-o2.glb
info: prune: No unused properties found.

error: memory access out of bounds

@donmccurdy
Copy link
Owner

On MacOS the error message doesn't mention memory, but reports a "bus error". 🤔

I'm also noticing validation errors that look important here. Is it possible this could be an error in the UnityGLTF exporter? I'd be curious what glTF Pipeline is doing to handle NaN, I'm not sure we'd want to scrub through vertex data looking for those.

code message severity pointer
ACCESSOR_INVALID_FLOAT Accessor element at index 107644 is NaN. 0 /accessors/2
ACCESSOR_INVALID_FLOAT Accessor element at index 107645 is NaN. 0 /accessors/2
ACCESSOR_INVALID_FLOAT Accessor element at index 107646 is NaN. 0 /accessors/2
ACCESSOR_INVALID_FLOAT Accessor element at index 107648 is NaN. 0 /accessors/2
ACCESSOR_INVALID_FLOAT Accessor element at index 107649 is NaN. 0 /accessors/2
ACCESSOR_INVALID_FLOAT Accessor element at index 107650 is NaN. 0 /accessors/2
ACCESSOR_INVALID_FLOAT Accessor element at index 107652 is NaN. 0 /accessors/2
ACCESSOR_INVALID_FLOAT Accessor element at index 107653 is NaN. 0 /accessors/2
ACCESSOR_INVALID_FLOAT Accessor element at index 107654 is NaN. 0 /accessors/2

@marwie
Copy link
Contributor Author

marwie commented May 2, 2023

Hello @donmccurdy I tried exporting the obj to glb using Blender and that works fine with draco then - so it's most likely a UnityGLTF bug as you said. I should have checked the validation errors error, sorry.

@donmccurdy
Copy link
Owner

donmccurdy commented May 2, 2023

Cool, no worries! Glad the validator catches this stuff, not sure how we'd have discovered a small handful of NaNs in there otherwise. 😅

@hybridherbst
Copy link

Just to close the loop, it's actually a Unity OBJ Importer bug 🥹, the importer produces a bunch of NaN tangents for that model. I've followed up with them and added some sanitization for exporting with UnityGltf. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working package:extensions
Projects
None yet
Development

No branches or pull requests

3 participants