kstenerud / KSCrash

The Ultimate iOS Crash Reporter
MIT License
4.23k stars 707 forks source link

FIX: Resolve stack overflow caused by insufficient disk space. #479

Closed xuezhulian closed 4 months ago

xuezhulian commented 4 months ago

When the disk space is insufficient, the ksfu_flushBufferedWriter method will return false, and the value of writer->position will not be set to 0. Continuing to write values to writer->buffer at this point will result in a stack overflow.

xuezhulian commented 4 months ago

@GLinnik21 writer->buffer is a variable allocated on the stack, so it causes a stack overflow. char writeBuffer[1024];

GLinnik21 commented 4 months ago

Let’s add some unit tests. If it’s too complex without mocks or dependency injection, we can merge it as is.

xuezhulian commented 4 months ago

Sorry, writing unit tests is quite challenging for me.😞