CocoaLumberjack/CocoaLumberjack — pull request #255 by ewanmellor (2014-04-01 01:53:00+00:00)
Title: Fix a rare crash caused by an unchecked return value.

Fix a rare crash in CompressingLogFileManager caused by an
unchecked result from read. If the read fails, it returns -1.
This was then added to inputDataSize, which in turn is added to
inputRemaining further down the function, and used as an input
to memmove (and is unsigned to boot, so it'll be very large rather than
negative). This means that the memmove stomps all over memory,
and we crash not long afterwards (often when an autorelease pool is
freed).

This crash is rare because it depends on the read call failing.

Fix this by checking the return value from NSStream.read, and leaving
the loop immediately if there's an error.