From: Andres Mejia Date: Sat, 26 Jan 2013 17:01:13 +0000 (-0500) Subject: Add checks for proper return value reading past EOF in RAR archives. X-Git-Tag: v3.1.2~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94b616c830a2895d30234e711e9ea8d62714b3f7;p=thirdparty%2Flibarchive.git Add checks for proper return value reading past EOF in RAR archives. --- diff --git a/libarchive/test/test_read_format_rar.c b/libarchive/test/test_read_format_rar.c index 7bb89ffc2..bf107bc66 100644 --- a/libarchive/test/test_read_format_rar.c +++ b/libarchive/test/test_read_format_rar.c @@ -1237,6 +1237,15 @@ DEFINE_TEST(test_read_format_rar_multivolume_seek_data) assertEqualInt(file_size + 20, archive_seek_data(a, 20, SEEK_END)); assertEqualInt(file_size - 20, archive_seek_data(a, -20, SEEK_END)); + /* + * Attempt to read from the end of the file. These should return + * 0 for end of file. + */ + assertEqualInt(file_size, archive_seek_data(a, 0, SEEK_END)); + assertA(0 == archive_read_data(a, buff, sizeof(buff))); + assertEqualInt(file_size + 40, archive_seek_data(a, 40, SEEK_CUR)); + assertA(0 == archive_read_data(a, buff, sizeof(buff))); + /* Seek to the end minus 64 bytes */ assertA(0 == archive_seek_data(a, 0, SEEK_SET)); assertA(file_size - (int)sizeof(buff) ==