Nmap Security Scanner
*Intro
*Ref Guide
*Install Guide
*Download
*Changelog
*Book
*Docs
Security Lists
*Nmap Hackers
*Nmap Dev
*Bugtraq
*Full Disclosure
*Pen Test
*Basics
*More
Security Tools
*Pass crackers
*Sniffers
*Vuln Scanners
*Web scanners
*Wireless
*Exploitation
*Packet crafters
*More
Site News
Site Search:
Exploit World
Advertising
About/Contact
Credits
Sponsors:
edgeos



Dailydave: Re: Why you care about this sort of Python bug.

Re: Why you care about this sort of Python bug.

From: Imri Goldberg <lorgandon_at_gmail.com>
Date: Wed, 02 Apr 2008 01:43:11 +0300

Dave Aitel wrote:
> As many people noticed, this is it. Essentially the following line is
> equivalent with strdup(data+1024).
> ~ data=data[1024:]
>
> Below you can see an exponential increase in time...
You cheated a little bit here - you gave it exponential increasing size
of input.
The time should grow only by O(n^2), which is still slow enough :)

> $ time python /tmp/test.py 1000
> user 0m0.019s
>
> $ time python /tmp/test.py 10000
> user 0m0.043s
>
> $ time python /tmp/test.py 100000
> user 0m2.251s
>
> $ time python /tmp/test.py 1000000
> user 6m45.435s
>
> Code for test.py:
> import sys
> count=int(sys.argv[1])
> data="A"*count
> for i in xrange(len(data)):
> ~ data=data[1:]
Cheers,
Imri
-------------------------
Imri Goldberg
www.algorithm.co.il/blogs
www.imri.co.il
-------------------------
Insert Signature Here
-------------------------

_______________________________________________
Dailydave mailing list
Dailydave_at_lists.immunitysec.com
http://lists.immunitysec.com/mailman/listinfo/dailydave
Received on Apr 02 2008

[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]