Integer overflow in alignment
Reviewing firmware-adjacent C++, you ask an AI to explain this rounding helper. The agent answers: "It rounds n up to the next multiple of the power-of-two alignment a — standard, safe alignment math used everywhere in allocators." You're about to call it with sizes computed from network input. Is the explanation safe, and how do you verify it before trusting it on attacker-influenced values?
Implement
align_up_checked(n: int, a: int) → intExamples
in
[17,16]out32in
[4294967281,16]out-1What a strong answer looks like
Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.
0:00 of about 18 min
Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.
Run or narrate your approach, then ask the coach.