Skip to content

Bug sweep: C course (11 findings) #15

Closed

Description

@otzpt

Found by a read-and-run sweep of this area on 2026-11-09. Each item was reproduced by a finder and checked by a second agent that tried to refute it.

Status key: fix drafted = a change exists on a local branch (fix/bug-sweep) but is not reviewed or merged. refuted = the second agent could not confirm it; kept here for a human decision.

  • C1 (fix drafted) c/src/lessons_advanced.c:938: Module 14 challenge passes solution_lines=60 but the solution[] array has 62 entries, so the last two explanatory lines are never shown to the student.
  • C2 (fix drafted) c/src/lessons_advanced.c:94: Module 11 prints 'The %1 shifts it to 1..100' where the text means '+1'; the printf escape %% turns the intended '+1' into a literal '%1'.
  • C3 (fix drafted) c/src/lessons_advanced.c:886: Module 14 bracket-checker example solution pushes onto a fixed char items[100] stack with no capacity check, in the same module that teaches that check; more than 100 opening brackets corrupts the stack's own top field.
  • C4 (fix drafted) c/src/lessons_tooling.c:529: Module 16 PART 7 says the displayed text is 'c/Makefile, copy-pasted, unedited' and that the Makefile builds 'six source files', but the embedded copy differs from the real c/Makefile (6 sources vs 9, no asm-demo target, shorter comment header, clean rule lacks asm outputs, .PHONY lacks asm-demo).
  • C5 (fix drafted) c/src/lessons_io.c:300: The re-prompt loop taught in module 18 PART 4 drains with 'while (getchar() != '\n') { }', which spins forever at end of input (Ctrl-D or redirected input) because getchar returns EOF, never '\n'.
  • C6 (refuted) c/src/main.c:103: Menu uses atoi on user input; a number that overflows int wraps into a valid module number instead of 'Not a valid option'.
  • C7 (fix drafted) c/src/lessons_tooling.c:249: Module 16 PART 2 says a typedef cannot appear twice in a translation unit, but a repeated identical typedef compiles under the module's own flags (-std=c11).
  • C8 (fix drafted) c/src/lessons_memory.c:865: Module 10 shows a compiler error message in clang's wording ('member reference type ... is a pointer; did you mean to use ->') as what 'the compiler tells you', but the course builds with gcc, which prints different text.
  • C9 (fix drafted) c/src/lessons_lang_features.c:131: Module 19 says the MODULES table replaces an '18-case switch' but main.c's table has 20 entries.
  • C10 (refuted) c/src/lessons_tooling.c:237: Modules 16-18 write scratch files to fixed, predictable /tmp paths with fopen("w"), which follows a pre-planted symlink and overwrites its target, then compile and execute binaries at those same fixed paths.
  • C11 (fix drafted) c/ROADMAP.md:28: ROADMAP states content as built that the lessons do not contain or contradict: scope/lifetime 'a PART in module 2', recursion with 'a real stack-depth failure shown, not simulated', module 12 'each shown broken first', const-pointer PART with 'a compiler warning shown'.

Not run in this sweep (tool missing or out of scope):

  • AddressSanitizer / UBSan builds (libasan/libubsan not installed: ld cannot find -lasan), so the LeakSanitizer and ASan report text in modules 9, 12 and 17 was not verified
  • gdb-driven parts of module 17 (gdb not installed); module 17 PART 4 and PART 5 ASan runs and the 'AddressSanitizer names line 8' answer not run
  • valgrind claims in module 9 (valgrind not installed)
  • docs/writing-a-course.md not re-read in full; only CONTRIBUTING.md was read for rules
  • clang wording claim in finding C8 not checked against clang (not installed)
  • Interactive behaviour with a real terminal (only piped input was used); over-long input line leftover in read_line was not reproduced and is not reported
  • Windows-only branches (_WIN32 clear_screen, WIFEXITED shims) not compilable here
  • tools/check-teaching-order.py not run (outside the c-course scope)

Activity

  1. added
    bug
    on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions