OpenUSD icon indicating copy to clipboard operation
OpenUSD copied to clipboard

Exception throws in UsdStage::Open() for fuzzed usd model

Open Hongyuan-Li opened this issue 2 years ago • 5 comments

Description of Issue

Exception throws in UsdStage::Open() for fuzzed usd model

Steps to Reproduce

  1. unzip the package
  2. when open usd file
  3. exception throws as below AnimationWithDifferentTangents---!6iyg1lvyfzp6u-a9fp82b9a18.zip Exception

System Information (OS, Hardware)

Windows 10

Package Versions

Build Flags

Hongyuan-Li avatar Jul 13 '23 05:07 Hongyuan-Li

Filed as internal issue #USD-8504

jesschimein avatar Jul 17 '23 21:07 jesschimein

FYI the usd model contains too many tokens in TOKEN section.

./tusdcat ../data/AnimationWithDifferentTangents---\!6iyg1lvyfzp6u-a9fp82b9a18.usd         ERR : [error]/home/syoyo/work/tinyusdz/src/crate-reader.cc[Crate]:ReadTokens():4511 Too many Tokens.

syoyo avatar Aug 01 '23 19:08 syoyo

@syoyo right, this is a Fuzzed USD model and I want to know if there will be a fix in future to avoid this exception ?

Hongyuan-Li avatar Oct 12 '23 08:10 Hongyuan-Li

So the exception here is a std::bad_alloc exception that USD is just not catching, by design, right now. We have recently been reconsidering our use of and policy for exceptions, and will have another look at this one in light of that. We will update when we have more info!

spiffmon avatar Oct 12 '23 23:10 spiffmon

We've recently been thinking about this again, and while we think that there are potentially many legit files that could also throw that exception (e.g. on resource-limited platforms), we do think it prudent to try to catch and error/recover from exceptions thrown from inside plugin code in as many of OpenUSD's plugin API's as possible, so we intend to work our way through those API's. For non-virtual-interface API's like SdfLayer and ArResolver, this will be relatively straightforward, and, inspired by this report, will first tackle SdfLayer::FindOrOpen(), which already returns a NULL SdfLayerRefPtr in error cases we can identify ourselves. In general, exceptions will be turned into TF_RUNTIME_ERROR, which clients can handle on an opt-in basis, and which turn into python exceptions if not handled in C++ client code.

spiffmon avatar Jun 13 '24 21:06 spiffmon