메모리 안전성Memory safety

CWE-190 정수 오버플로Integer Overflow or Wraparound

정수 연산 결과가 표현 범위를 넘어 감싸지는(wrap) 결함.An integer calculation wraps around its representable range.

근본 원인 패턴Root-cause pattern

크기 = 개수 × 원소크기 계산이 감싸져 작은 버퍼가 할당되고, 이후 원래 개수만큼 쓰면서 경계 밖 쓰기로 이어진다.size = count * elem wraps, a small buffer is allocated, then the original count is written → OOB write.

전형적인 패치Typical fix

오버플로 검사 내장 함수(__builtin_mul_overflow 등), 상한 검증.Overflow-checked builtins, explicit upper bounds.

0 편posts

아직 이 클래스의 글이 없습니다. 아래 패턴 요약으로 먼저 학습하세요.No posts in this class yet. Start with the pattern summary below.

✎ CWE-190 퀴즈 풀기Quiz on CWE-190