Bug #61068 [Fbk->Opn]: Regexp crashes http server
| From: | bald at epf dot pl | Date: | Mon, 13 Feb 2012 10:43:55 +0000 |
| Subject: | Bug #61068 [Fbk->Opn]: Regexp crashes http server | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-167470@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61068&edit=1
ID: 61068
User updated by: bald at epf dot pl
Reported by: bald at epf dot pl
Summary: Regexp crashes http server
-Status: Feedback
+Status: Open
Type: Bug
Package: *Regular Expressions
-Operating System: Windows XP
+Operating System: Windows 7
PHP Version: 5.3.10
Block user comment: N
Private report: N
New Comment:
Sorry, it's Windows 7. Apache logs does not really say anything. This regular expression just
kills my httpd.exe proccess. Works fine without character < at the begining of the $string
variable.
Previous Comments:
------------------------------------------------------------------------
[2012-02-13 09:01:19] rasmus@php.net
I was unable to reproduce any sort of Apache crash with this code on Linux. Are
you really on XP? What does it say in your Apache logs?
------------------------------------------------------------------------
[2012-02-13 08:53:02] bald at epf dot pl
Description:
------------
Regular expression crashes http server. It's all because character < at the beginning of te
string.
Test script:
---------------
<?php
$string = '< PASS_COUNT; i++) { if (strcmp(password, PASSWD2) == 0) continue; } c++; if (c
== 3) break; } // Tu wlasciwe sprawdzanie hasla }dku gdy liczy sie wydajnosc, gdyz petle zabieraja
niestety troche czasu :( ale jest to niewiele i w sumie to nie czuc roznicy. Kolejna sprawa jest
sposob porownywania hasla. NIGDY nie dokonuj deszyfracji klucza w programie (mam nadzieje ze chociaz
szyfrujesz klucze :)). Jest to pierwsza i najwazniejsza zasada ! Wiec jak sprawdzic czy wprowadzony
klucz jest poprawny. Zaszyfruj go i porownaj zaszyfrowane klucze. Ktos kto sledzi Twoj program ma
wtedy utrudnione zadanie, a gdy poprawny klucz jest deszyfrowany to ktos sobie przejdzie do momentu
az klucz bedzie zdeszyforwany i tylko go spisze. Od metody szyfracji zalezy bezpieczenstwo Twojego
programu wiec staraj sie dobierac algorytm, ktory dobrze szyfruje (nie mowie tu o Triple-DES itp. ;)
). Marzeniem bylby algorytm jednostronny, ktorego odszyfrowania jest trudniejsze niz brute-force ale
na to nie licz. Najlepiej ';
preg_match('~(</?)(\w*)((/(?!>)|[^/>])*)(/?>)~', $string, $matches);
?>
Expected result:
----------------
Blank page.
Actual result:
--------------
Apache fails.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61068&edit=1