]> granicus.if.org Git - php/commitdiff
Tests for upcoming patches to crypt, as discussed with Pierre over IRC.
authorJoey Smith <joey@php.net>
Fri, 19 Feb 2010 21:08:35 +0000 (21:08 +0000)
committerJoey Smith <joey@php.net>
Fri, 19 Feb 2010 21:08:35 +0000 (21:08 +0000)
ext/standard/tests/strings/bug51059.phpt [new file with mode: 0644]
ext/standard/tests/strings/crypt_blowfish_invalid_rounds.phpt [new file with mode: 0644]

diff --git a/ext/standard/tests/strings/bug51059.phpt b/ext/standard/tests/strings/bug51059.phpt
new file mode 100644 (file)
index 0000000..baf8a12
--- /dev/null
@@ -0,0 +1,11 @@
+--TEST--
+Bug #51059 crypt() segfaults on certain salts
+--FILE--
+<?php
+
+if (crypt('a', '_') === FALSE) echo 'OK';
+else echo 'Not OK';
+
+?>
+--EXPECT--
+OK
diff --git a/ext/standard/tests/strings/crypt_blowfish_invalid_rounds.phpt b/ext/standard/tests/strings/crypt_blowfish_invalid_rounds.phpt
new file mode 100644 (file)
index 0000000..6d40b07
--- /dev/null
@@ -0,0 +1,22 @@
+--TEST--
+Test Blowfish crypt() with invalid rounds
+--FILE--
+<?php
+
+foreach(range(32, 38) as $i) {
+  if (crypt('U*U', '$2a$'.$i.'$CCCCCCCCCCCCCCCCCCCCCC$') === FALSE) {
+    echo "$i. OK\n";
+  } else {
+    echo "$i. Not OK\n";
+  }
+}
+
+?>
+--EXPECT--
+32. OK
+33. OK
+34. OK
+35. OK
+36. OK
+37. OK
+38. OK