The vulnerability exists in the way github.com/sirupsen/logrus handles logging from an io.Writer interface, specifically when using Entry.Writer() or Entry.WriterLevel(). These functions create a pipe and spawn a goroutine running the Entry.writerScanner function to read from the pipe.
The root cause of the vulnerability is in the Entry.writerScanner function. Prior to the patch, it used a standard bufio.Scanner to read log lines. The default bufio.Scanner has a maximum line length (token size) of 64KB. If an application wrote a single line of data exceeding this limit to the writer, the scanner would fail with a bufio.ErrTooLong error. The error handling in place would then close the pipe, rendering the writer permanently unusable for any further logging. This would cause the application to hang or crash if it continued to try logging, resulting in a Denial of Service (DoS).
The patch addresses this by modifying Entry.writerScanner to handle large inputs. It implements a custom split function for the bufio.Scanner that chunks the input data into 64KB segments. This prevents the 'token too long' error, allowing the logger to process arbitrarily long single-line payloads by breaking them down into manageable pieces. The vulnerable functions are Entry.Writer and Entry.WriterLevel, which initiate the process, and Entry.writerScanner, which contains the flawed scanning logic.