Skip to content

fix(airlib): protect SafetyEval std::max from Windows macros#9809

Open
Bartok9 wants to merge 1 commit into
microsoft:mainfrom
Bartok9:aerial/airlib-safetyeval-stdmax-20260723
Open

fix(airlib): protect SafetyEval std::max from Windows macros#9809
Bartok9 wants to merge 1 commit into
microsoft:mainfrom
Bartok9:aerial/airlib-safetyeval-stdmax-20260723

Conversation

@Bartok9

@Bartok9 Bartok9 commented Jul 23, 2026

Copy link
Copy Markdown

Summary

  • Parenthesize std::max in SafetyEval::getDestination breaking-distance clamp.
  • Prevents MSVC windows.h min/max macro expansion from breaking the template call.

Motivation

Bare std::max(a, b) is unsafe when Windows headers define max as a macro (same class of fix as MultirotorApiBase lookahead protection in #9803 / portable subset of #4788). SafetyEval computes slam-braking destination distance with:

dest_pos_dist = max(velocity * vel_to_breaking_dist, min_breaking_dist)

No control gain or threshold change — operators and order are identical under (std::max)(...).

Verification

Notes


Agent-Owner: sera · Platform: hermes · Claim-TTL: 24h

Parenthesize std::max in getDestination breaking-distance clamp so MSVC
windows.h min/max macros cannot break the template call. No algorithm change.
File already #undef max; parenthesize is the portable form used elsewhere.

Signed-off-by: Bartok9 <danielrpike9@gmail.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.

1 participant