[or-cvs] 17 does not divide 1024, but it can stomp some interesting ...

Nick Mathewson nickm at seul.org
Thu Apr 17 01:56:08 UTC 2003


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv24114/src/or

Modified Files:
	test.c 
Log Message:
17 does not divide 1024, but it can stomp some interesting pointers and segfault the test suite

Index: test.c
===================================================================
RCS file: /home/or/cvsroot/src/or/test.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- test.c	16 Apr 2003 23:21:44 -0000	1.6
+++ test.c	17 Apr 2003 01:56:06 -0000	1.7
@@ -311,7 +311,6 @@
     crypto_free_cipher_env(env2);
 
     memset(data3, 0, 1024);
-
     env2 = crypto_new_cipher_env(str_ciphers[i]);
     test_neq(env2, 0);
     if (str_ciphers[i] != CRYPTO_CIPHER_IDENTITY) {
@@ -319,7 +318,7 @@
     }
     crypto_cipher_set_iv(env2, "12345678901234567890");
     crypto_cipher_encrypt_init_cipher(env2);
-    for (j = 0; j < 1024; j += 17) {
+    for (j = 0; j < 1024-16; j += 17) {
       crypto_cipher_encrypt(env2, data1+j, 17, data3+j);
     }
     for (j= 0; j < 1024-16; ++j) {
@@ -328,7 +327,6 @@
       }
     }
     test_memeq(data2, data3, 1024-16);
-    
     crypto_free_cipher_env(env1);
     crypto_free_cipher_env(env2);
   }
@@ -444,7 +442,7 @@
   test_buffers();
   puts("========================== Crypto ==========================");
   test_crypto(); /* this seg faults :( */
-  puts("========================== Util ============================");
+  puts("\n========================== Util ============================");
   test_util();
   puts("");
   return 0;



More information about the tor-commits mailing list