Skip to content

Commit 4f3ec93

Browse files
committed
Fast return for insufficient memory.
1 parent 4563e4d commit 4f3ec93

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Encoding/COBS.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ class COBS
103103
/// \warning destination must have a minimum capacity of size.
104104
static size_t decode(const uint8_t* source, size_t size, uint8_t* destination)
105105
{
106+
if (size == 0)
107+
return 0;
108+
106109
size_t read_index = 0;
107110
size_t write_index = 0;
108111
uint8_t code;

0 commit comments

Comments
 (0)