# Stack Overflow Vulnerability

> Detects code patterns that can cause stack overflows via unbounded recursion or excessive stack allocation.

- Skill: `zakirkun/stack-overflow-vulnerability` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add zakirkun/stack-overflow-vulnerability`
- Raw SKILL.md: https://api.skillmd.com/api/skills/zakirkun/stack-overflow-vulnerability/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: zakirkun (https://skillmd.com/u/zakirkun)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/zakirkun/stack-overflow-vulnerability

---


# Stack Overflow

## Overview
Stack overflows occur when the call stack exceeds available memory:
- **Unbounded recursion**: Recursive functions without base case or depth limit
- **Large stack allocations**: Variable-length arrays (VLAs) with user-controlled size
- **Deep call chains**: Complex XML/JSON parsing with deeply nested structures

In C/C++, stack overflows corrupt adjacent memory and can lead to code execution.

## Remediation
- Add recursion depth limits
- Use iterative algorithms instead of recursive ones for user-controlled depth
- Validate nesting depth of parsed structures
- Use `ulimit` or OS-level stack size limits

