Skip to content

Remove unused boost headers from pch.h files#2323

Closed
nvmkuruc wants to merge 1 commit intoPixarAnimationStudios:devfrom
nvmkuruc:pchcleanup
Closed

Remove unused boost headers from pch.h files#2323
nvmkuruc wants to merge 1 commit intoPixarAnimationStudios:devfrom
nvmkuruc:pchcleanup

Conversation

@nvmkuruc
Copy link
Copy Markdown
Collaborator

@nvmkuruc nvmkuruc commented Mar 3, 2023

Description of Change(s)

boost/mpl/or.hpp, boost/mpl/if.hpp, boost/mpl/and.hpp, boost/type_traits/is_signed.hpp, and boost/utility/in_place_factory.hpp are no longer used in the pxr code base and can be safely removed from all pch.h files.

Fixes Issue(s)

  • I have verified that all unit tests pass with the proposed changes
  • I have submitted a signed Contributor License Agreement

@nvmkuruc nvmkuruc force-pushed the pchcleanup branch 3 times, most recently from 24c1a32 to a0bdec7 Compare March 3, 2023 21:17
@sunyab
Copy link
Copy Markdown
Contributor

sunyab commented Mar 14, 2023

Filed as internal issue #USD-8084

@spiffmon
Copy link
Copy Markdown
Member

spiffmon commented Mar 1, 2024

@nvmkuruc , we're going to close this in favor of rerunning our internal pch-generator script so we can be confident we'll continue to get the right results going forward. Thanks, though!

@spiffmon spiffmon closed this Mar 1, 2024
@nvmkuruc nvmkuruc deleted the pchcleanup branch May 20, 2024 15:08
musicinmybrain pushed a commit to musicinmybrain/OpenUSD that referenced this pull request Apr 7, 2026
…ecoder) (PixarAnimationStudios#2323)

In the `EXR_PIXEL_FLOAT` branch of `undo_pxr24_impl()`, the expressions

    (uint64_t)(w * 3)

compute the signed 32-bit product `w * 3` before the cast to `uint64_t`.
When `w` is large this is undefined behavior under the C standard; on
two's-complement builds without sanitizers the result wraps to a small
positive value, which can cause the bounds check

    if (nDec + (uint64_t)(w * 3) > outSize)

to pass incorrectly. If the check is bypassed the decode loop proceeds
to write `4*w` bytes through `dout`, potentially far beyond the allocated
output buffer.

Fix: cast `w` to `uint64_t` before multiplying so that both the bounds
check and the counter update are performed entirely in 64-bit unsigned
arithmetic:

    (uint64_t)w * 3   (cast before multiply, not after)

The `EXR_PIXEL_UINT` and `EXR_PIXEL_HALF` decode branches are unaffected:
they reuse the pre-computed `nBytes` variable, which is already formed as
`(uint64_t)(w) * (uint64_t)(bytes_per_element)`.

Also fix the symmetric issue in `apply_pxr24_impl()` (the encoder):
    lastIn += w * 4
advances a pointer by a signed 32-bit product; corrected to
    lastIn += (uint64_t)w * 4

Made-with: Cursor

Signed-off-by: Cary Phillips <cary@ilm.com>
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

Successfully merging this pull request may close these issues.

3 participants