bug72535.phpt 663 B

1234567891011121314151617181920212223
  1. --TEST--
  2. Bug #72535 arcfour encryption stream filter crashes php
  3. --SKIPIF--
  4. <?php if (!extension_loaded("mcrypt")) print "skip"; ?>
  5. --FILE--
  6. <?php
  7. $passphrase = 'My secret';
  8. $plaintext = 'Secret secret secret data';
  9. $iv = substr(md5('iv' . $passphrase, true), 0, 8);
  10. $key = substr(md5('pass1' . $passphrase, true) .
  11. md5('pass2' . $passphrase, true), 0, 24);
  12. $opts = array('iv' => $iv, 'key' => $key, 'mode' => 'stream');
  13. $expected = substr($plaintext . $plaintext, 0, 48);
  14. $fp = fopen('php://memory', 'wb+');
  15. stream_filter_append($fp, 'mcrypt.arcfour', STREAM_FILTER_WRITE, $opts);
  16. fwrite($fp, $plaintext);
  17. ?>
  18. ==NOCRASH==
  19. --EXPECT--
  20. ==NOCRASH==