You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: a year-month interval writes every byte of SQL_INTERVAL_STRUCT
`SQL_YEAR_MONTH_STRUCT` is two SQLUINTEGERs where `SQL_DAY_SECOND_STRUCT` is
five, so constructing the union through its year-month arm alone left the
last twelve bytes uninitialised. The whole struct is then copied into the
application's buffer, so those twelve bytes were driver stack handed to the
caller: uninitialised memory an application can read back, and a disclosure
however dull its contents.
The union is now initialised through its widest arm first and only then
overwritten, so every byte of the value is defined whichever target was
asked for.
Miri found it, as an uninitialised `DaySecond::minute` on the year-month
tests, reading through a test helper whose SAFETY comment claimed it read
only the arm the target wrote. It did not: building that struct reads both
arms eagerly however few the caller goes on to inspect. The comment now
records what the soundness actually rests on.
The accompanying test asserts the post-condition but is explicitly not the
guard: the skipped bytes come from the driver's own stack rather than from
the destination buffer, so nothing the test controls decides their value and
reverting the fix does not reliably fail it. Miri is what sees this, which is
why it runs on every pull request.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
0 commit comments