mirror of
https://github.com/facebook/zstd.git
synced 2025-08-01 09:47:01 +03:00
fix the assertion in readLinesFromFile (#3084)
* fix the assertion in readLinesFromFile When the file is not terminated by endline, readLineFromFile will append a '\0' for the last line. In this case pos + lineLength == dstCapacity. * test: don't print very long text garbage
This commit is contained in:
@ -418,7 +418,7 @@ readLinesFromFile(void* dst, size_t dstCapacity,
|
||||
while ( !feof(inputFile) ) {
|
||||
size_t const lineLength = readLineFromFile(buf+pos, dstCapacity-pos, inputFile);
|
||||
if (lineLength == 0) break;
|
||||
assert(pos + lineLength < dstCapacity);
|
||||
assert(pos + lineLength <= dstCapacity); /* '=' for inputFile not terminated with '\n' */
|
||||
pos += lineLength;
|
||||
++nbFiles;
|
||||
}
|
||||
|
Reference in New Issue
Block a user