1
CHAPTER 1

Logic & Control Flow Bugs

Errors in conditional statements, loops, and program logic that cause unexpected behavior
[6 examples]

Array index out of bounds

Program accesses invalid array indexes, causing crashes or errors.

memoryundefined behavioredge case
[8 examples]

Buffer overflow

Data exceeds allocated memory, risking crashes or security issues.

memorysecurityc++
[1 examples]

Divide by zero

Attempted division using zero, causing runtime errors or crashes.

logicedge caseundefined behavior
[1 examples]

Uninitialized variable

Variable used without an assigned value, causing unpredictable behavior.

undefined behaviorlogicc++
[2 examples]

Variable shadowing

Inner variable hides an outer one, leading to confusion or bugs.

code qualitylogicdebugging
[20 examples]

Unreachable code

Code segment that can never execute, wasting resources.

logiccode qualitydebugging
[29 examples]

Integer overflow

Integer exceeds the maximum allowed value, leading to incorrect results.

logicundefined behaviorc++
[1 examples]

Integer underflow

Integer drops below the minimum allowed value, causing unexpected behavior.

logicundefined behaviorc++
[3 examples]

Loss of precision

Numeric data precision lost during calculations, causing errors.

type systemdata integrityc++
[2 examples]

Incorrect assignment

Value incorrectly assigned, causing unintended outcomes.

logiccode quality
[150 examples]

Logic error

Logical mistake resulting in incorrect outcomes.

logiccode quality
[2 examples]

Incorrect operator precedence

Operators evaluated in the wrong order, causing logical errors.

logicedge case
[7 examples]

Off-by-one error

Calculation errors from loop or array indexes off by one.

logicedge case