Code Room
Vibe codingHard
Question
An AI generated this C parser to walk frames in a packet buffer, using a signed length. A fuzzer found an infinite loop and an out-of-bounds read. Identify the signedness / loop bug, the input that triggers each, and the fix.
void walk_frames(const char *buf, int total) { int off = 0; while (off < total) { int frame_len = (int8_t)buf[off]; // length in next byte process(buf + off + 1, frame_len); off += frame_len + 1; }}What 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.
Learn the concepts
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.
Run or narrate your approach, then ask the coach.