CodeReforge

Rebuild Your Logic — Think Before You Run

Choose Your Mode

Select how you want to practice debugging and understanding code

Try Challenges

Practice with pre-saved buggy code snippets

Debug My Code

Paste your own code and debug it step-by-step

Select a Challenge

Choose a buggy code snippet to analyze and fix

Memory Leak in Resource Management

This code from cppcheck has a memory management issue. Predict what happens.

memory managementmemory leaksdynamic allocation

Null Pointer Dereference

This code from libxml2 may have an issue. Trace through and predict the behavior.

null pointerspointer safetydefensive programming

Buffer Overflow Vulnerability

This code from openssl may have a security issue. Predict what happens.

buffer overflowsecuritybounds checking

Integer Overflow

This code from cppcheck may have an arithmetic issue. Predict the output.

integer overflowtype limitsarithmetic safety

Use After Free

This code may have a memory safety issue. Trace the memory lifecycle.

memory safetyuse after freedangling pointers

Uninitialized Variable

This code from yaml_cpp may have an issue. Predict the output.

uninitialized variablesundefined behaviorvariable initialization

Double Free Error

This code may have a memory management issue. Predict what happens.

double freememory managementresource cleanup

Array Index Out of Bounds

This code from libtiff may have an array access issue. Predict what happens.

array boundsoff-by-one errorsbuffer safety

Buggy Factorial

This factorial function has a bug. Predict what it will output before running it.

recursionbase casesfunction calls

Off-by-One Loop Bug

This loop should sum numbers from 0 to 4, but something is wrong. Predict the final values.

loopsoff-by-one errorsloop conditions

Array Reference Bug

This code modifies an array. Predict what will be logged and understand why.

pointersarray referencesmemory addresses

Variable Scope Mystery

Predict the output. Pay attention to variable scope and shadowing.

variable scopeglobal variablesvariable shadowing

Infinite Loop Bug

This code should count to 5, but something is wrong. Predict what happens.

loopsincrement operatorsloop termination