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

HdxColorizeSelectionTask, _instanceId and _elementId are accessed without null checks #1991

Closed
ShiraoShotaro opened this issue Aug 13, 2022 · 1 comment

Comments

@ShiraoShotaro
Copy link

Description of Issue

I create a new HdRenderPlugin. Its render delegate has 3 aovs (color, depth, primId).
Open usdview, switch renderer, and usdview crashes when I pick an object.

I found a cause,
pxr/imaging/hdx/colorizeSelectionTask.cpp, Line 286-287, in HdxColorizeSelectionTask::_ColorizeSelection()

    int32_t *iiddata = reinterpret_cast<int32_t*>(_instanceId->Map());
    int32_t *eiddata = reinterpret_cast<int32_t*>(_elementId->Map());

_instanceId and _elementId are accessed without null checks. (My render delegate does not provide instanceId nor elementId aov.)

cf. In HdxPickFromRenderBufferTask, they are accessed with null checks.
pxr/imaging/hdx/pickFromRenderBufferTask.cpp, Line 191-196, in HdxPickFromRenderBufferTask::Execute()

    uint8_t *elementIdPtr = _elementId ? 
                            reinterpret_cast<uint8_t*>(_elementId->Map()) : 
                            nullptr;
    uint8_t *instanceIdPtr = _instanceId ? 
                             reinterpret_cast<uint8_t*>(_instanceId->Map()) : 
                             nullptr;

I fixed ColorizeSelectionTask in reference to PickFromRenderBufferTask in my local, and the issue is cleared.

Steps to Reproduce

  1. Implement a new render delegate provides color, depth and primId aovs.
  2. Install plugin.
  3. Open usdview.
  4. Switch renderer; [View] -> [Hydra Renderer] -> [(Installed render plugin's name)]
  5. Pick object via viewport.

System Information (OS, Hardware)

OS: Windows 10 Pro (Version 21H2)
CPU: Intel® Core™ i3-4170
RAM: 8GB
GPU: GeForce GTX 980Ti (6GB)

Package Versions

USD 22.08 (with python 3.9)

Build Flags

Built by python build script,

python build_scripts\build_usd.py^
    --build-variant release^
    --build-shared^
    install\py39

Sincerely,
Shotaro Shirao.
(Sorry for my bad English.)

@sunyab
Copy link
Contributor

sunyab commented Aug 17, 2022

Filed as internal issue #USD-7558

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants