Skip to content

Conversation

vector-of-bool
Copy link
Contributor

Instead of doing a clever memcpy of a BE-encoded uint32_t bunch-of-bits, explicitly perform the encoding inline. Avoids a suspicious truncation of time_t to uint32_t, and explains why we are doing it.

This does not directly fix any behavioral issue, but makes the implementation less clever and more explicit for static analysis.

Coverity CID 123525 & CID 123519

Instead of doing a clever memcpy of a BE-encoded bunch-of-bits uint32_t,
explicitly perform the encoding inline. Avoids a suspicious
truncation of time_t to uint32_t, and explains why we are doing it.
@vector-of-bool vector-of-bool requested a review from kevinAlbs June 13, 2024 18:12
@kevinAlbs kevinAlbs changed the title Clean up OID init to avoid a suspicious time_t trunc CDRIVER-5607 Clean up OID init to avoid a suspicious time_t trunc Jun 13, 2024
@vector-of-bool vector-of-bool merged commit c1a9737 into mongodb:master Jun 14, 2024
@vector-of-bool vector-of-bool deleted the oid-init-time_t-cleanup branch June 14, 2024 18:05
vector-of-bool added a commit that referenced this pull request Jun 26, 2024
…1643)

* Clean up OID init to avoid a suspicious time_t trunc

Instead of doing a clever memcpy of a BE-encoded bunch-of-bits uint32_t,
explicitly perform the encoding inline. Avoids a suspicious
truncation of time_t to uint32_t, and explains why we are doing it.
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.

2 participants