summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorMichael Brown2014-01-08 23:21:23 +0100
committerMichael Brown2014-01-12 22:53:10 +0100
commit97fd5ccdd86f4c84b128e905c663b2bd7e6397fe (patch)
treef345f664066e7681b1166acb7c1ba1a74188499f /src/tests
parent[deflate] Add support for DEFLATE decompression (diff)
downloadipxe-97fd5ccdd86f4c84b128e905c663b2bd7e6397fe.tar.gz
ipxe-97fd5ccdd86f4c84b128e905c663b2bd7e6397fe.tar.xz
ipxe-97fd5ccdd86f4c84b128e905c663b2bd7e6397fe.zip
[deflate] Fix literal data length calculation
Fix incorrect calculation used to determine length of data to be copied within a literal data block, and add a test case to prevent this bug from going undetected in future. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/deflate_test.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/tests/deflate_test.c b/src/tests/deflate_test.c
index 1223492f..68c1aad9 100644
--- a/src/tests/deflate_test.c
+++ b/src/tests/deflate_test.c
@@ -78,6 +78,12 @@ DEFLATE ( literal, DEFLATE_RAW,
DATA ( 0x01, 0x04, 0x00, 0xfb, 0xff, 0x69, 0x50, 0x58, 0x45 ),
DATA ( 0x69, 0x50, 0x58, 0x45 ) );
+/* "iPXE" string, no compression, split into two literals */
+DEFLATE ( split_literal, DEFLATE_RAW,
+ DATA ( 0x00, 0x02, 0x00, 0xfd, 0xff, 0x69, 0x50, 0x01, 0x02, 0x00,
+ 0xfd, 0xff, 0x58, 0x45 ),
+ DATA ( 0x69, 0x50, 0x58, 0x45 ) );
+
/* Empty file */
DEFLATE ( empty, DEFLATE_RAW, DATA ( 0x03, 0x00 ), DATA() );
@@ -215,6 +221,7 @@ static void deflate_test_exec ( void ) {
/* Test as a single pass */
deflate_ok ( deflate, &empty_literal, NULL );
deflate_ok ( deflate, &literal, NULL );
+ deflate_ok ( deflate, &split_literal, NULL );
deflate_ok ( deflate, &empty, NULL );
deflate_ok ( deflate, &hello_world, NULL );
deflate_ok ( deflate, &hello_hello_world, NULL );