15 — Overflow

ValidationError

Overflow — MongoDB error code 15

Source code references

ErrorCodes::Overflow found in 53 locations in the MongoDB server source.

Detailed investigation data (common causes, diagnostic steps) is not yet available for this error code. The information above comes from the official MongoDB error code reference.

Related Issues

SERVER-139496Needs Scheduling
S2 heuristic counters have incorrect behavior on overflow
Our S2 geospatial third party library uses {{int}} counters for heuristics, like for when the cost of building a data structure indexing polygon vertices is likely to be amortized. * [S2Loop::num_find_vertex_calls_|https://github.com/10gen/mongo/blob/af22eb75e478f32fde03e16dfa748e4defa22055/src/third_party/s2/s2loop.h#L356] * [S2EdgeIndex::query_count_|https://github.com/10gen/mongo/blob/af22eb75e478f32fde03e16dfa748e4defa22055/src/third_party/s2/s2edgeindex.h#L243] For large collections
SERVER-130496Closed
Fix integer overflow in FLE2 readTags accumulator
h1. Security Context See SECBUG-1461 for problem description, security impact, preconditions, reproduction steps, and severity rationale. A verified Docker-based PoC is included in that ticket. h1. Root Cause The bug is a type-width mismatch in src/mongo/crypto/fle_tags.cpp::readTags(). Three lines interact to produce the exploit: +*Line 148 — accumulator declared as uint32_t*+ FLEEdgeCountInfo::count (fle_crypto_types.h:92) is uint64_t. The accumulation loop silently truncates each
SERVER-130965Closed
Handle unsigned overflow in FLE2 binary search
In {{binarySearchCommon()}} at [src/mongo/crypto/fle_crypto.cpp|https://github.com/10gen/mongo/blob/85387fec361fa96d0ef9ba7efb3fcf4e86d068a1/src/mongo/crypto/fle_crypto.cpp#L2293], the variable rho (uint64_t) is doubled via rho = 2 * rho inside a galloping loop with no overflow guard.  If this continuous doubling eventually becomes 0, the {{ceil(log2(rho))}} would return -inf and converting that to uint64_t is undefined behavior.
PYTHON-6252Closed
Fix signed-integer-overflow UB in bson buffer doubling past 1GiB
h3. Detailed steps to reproduce the problem? _Include full traceback, if possible_ The sanitizer Evergreen task (PYTHON-6048 [patch|https://spruce.corp.mongodb.com/task/mongo_python_driver_sanitizer_rhel8_test_sanitizer_patch_16d94e2b6ba2e11f93d344b55e9ecb237451d35f_6af30ecc1fe3e50007d15d0b_26_11_10_12_32_14/logs?execution=0]) dies silently (exit 1, no output) at {{{}test/test_bson.py::TestBSON::test_encode_size_limit{}}}: {{buffer_grow}} in {{bson/buffer.c}} doubles an {{int}} size while
SERVER-137674Open
Add upper bound to heartbeatTimeoutSecs
[heartbeatTimeoutSecs|https://github.com/10gen/mongo/blob/31f7deeb74b47ca9372001f40ac0e8a7835a301f/src/mongo/db/repl/repl_set_config.idl#L79-L85] has no upper bound, so sufficiently large values are accepted, but overflow when [converted to milliseconds|https://github.com/10gen/mongo/blob/31f7deeb74b47ca9372001f40ac0e8a7835a301f/src/mongo/db/modules/atlas/src/disagg_storage/disagg_repl_set_config.h#L219] (multiplied by 1000). We should add an upper bound to the IDL validator so these configs are
SERVER-92032Needs Scheduling
Chunk and/or Truncate very large audit payloads
It's possible for a bulkWrite or similar operation to overflow the BSON limits of audit writes.  Detect this and respond by either: * Truncating document writes when the limit is exceeded * Splitting the document payloads across multiple audit entries. This may mean creating a setParameter to control this behavior.
PYTHON-5996Closed
Harden bson buffer size guard against signed-overflow UB on >2GiB encode
h3. Detailed steps to reproduce the problem? _Include full traceback, if possible_ Encoding a single document whose values' cumulative encoded size exceeds INT_MAX (about 2 GiB) overflows the running buffer position in {{buffer_assure_space}} ({{bson/buffer.c}}). The overflow guard {{new_size < buffer->position}} depends on signed-overflow wraparound, which is undefined behavior. Compilers in the LLVM family (clang, and clang-based toolchains such as {{zig cc}} and Intel ICX) optimize the c
SERVER-133023Closed
Background tasks may not be properly exempted from load shedding
Claude says: There is an asymmetry in load shedding exemption logic: - ordered_ticket_semaphore.cpp:26-33 sheds only if getLowAdmissions() == 0 && queue >= maxWaiters && !admCtx->isLoadShedExempt(). - unordered_ticket_semaphore.cpp:58-67 sheds on previousWaiters >= _maxWaiters alone — no isLoadShedExempt() check, and also no getLowAdmissions() == 0 check. Git archaeology — it is an oversight, not a design choice - UnorderedTicketSemaphore (with its overflow shed) landed 2026-03-02 in
SERVER-137677Closed
Add zstd decompress pointer-overflow to UBSan denylist
h2. Overview The vendored zstd (1.5.5) computes a prefetch address in ZSTD_prefetchMatch (lib/decompress/zstd_decompress_block.c) as dictEnd + prefetchPos - offset. On corrupt input with no dictionary, dictEnd is NULL, which UBSan reports as "applying non-zero offset to null pointer". The address is only passed to PREFETCH_L1 and never dereferenced. Upstream fixed this in zstd 1.5.6 with ZSTD_wrappedPtrAdd/ZSTD_wrappedPtrSub. The libfuzzer variant hits this within seconds in protocol_fuzzer (se
SERVER-137706Closed
Signed int128 overflow (UB) in BSONColumn fuzzer when generating string delta runs