BurntNail / Souris

A tiny no_std database designed for optimising size at runtime cost.
MIT License
1 stars 0 forks source link

Address recursion in deserialization methods #8

Open coderabbitai[bot] opened 2 weeks ago

coderabbitai[bot] commented 2 weeks ago

Description

Methods like Node<u8>::deser in crates/sourisdb/src/utilities/huffman.rs use unbounded recursion, which could lead to stack overflow when handling malicious inputs that create deeply nested structures.

We should consider refactoring these methods to use iterative approaches or implement recursion depth checks to prevent potential stack overflows.

Related PR: https://github.com/BurntNail/Souris/pull/7
Comment: https://github.com/BurntNail/Souris/pull/7#discussion_r1832050851
Requested by: @BurntNail

coderabbitai[bot] commented 2 weeks ago

There's a potential stack overflow in Huffman<u8>::deser due to recursive deserialization identified in PR #7. Consider implementing a maximum recursion depth or refactoring to an iterative deserialization approach to enhance robustness. See this comment for more details.