summaryrefslogtreecommitdiff
path: root/libarchive
diff options
context:
space:
mode:
authorAndres Mejia <amejia004@gmail.com>2013-01-26 12:01:13 -0500
committerAndres Mejia <amejia004@gmail.com>2013-01-26 12:01:13 -0500
commit94b616c830a2895d30234e711e9ea8d62714b3f7 (patch)
tree45025127d9c6d5e0d1b008c68e9c454f987af68b /libarchive
parentf2bd4d81617b4df86c388b8f4377cc0333676571 (diff)
downloadlibarchive-94b616c830a2895d30234e711e9ea8d62714b3f7.tar.gz
Add checks for proper return value reading past EOF in RAR archives.
Diffstat (limited to 'libarchive')
-rw-r--r--libarchive/test/test_read_format_rar.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libarchive/test/test_read_format_rar.c b/libarchive/test/test_read_format_rar.c
index 7bb89ffc..bf107bc6 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) ==