| Ticket UUID: | 2006342 | ||
| Title: | [expr] can bypass [interp limit] | ||
| Type: | Bug | Created on: | 2008-06-30 03:37:54 |
| Submitter: | mistachkin | Assigned to: | kennykb |
| Subsystem: | 56. LibTomMath | Severity: | |
| Priority: | 5 Medium | Last modified: | 2008-07-13 18:19:05 |
| Status: | Open | Closed by: | |
| Resolution: | None | Closed on: | |
| Version: | obsolete: 8.6a1 | ||
| Description: | ||||
The arbitrary-precision integers support in [expr] can cause it to run for quite some time; however, it cannot currently be interrupted by [interp limit]. For safe interpreters, this could lead to a potential denial-of-service.
Example:
% info patchlevel
8.5.2
% set i [interp create]
interp0
% interp limit $i time -seconds [expr {[clock seconds] + 10}]
% interp limit $i time
-command {} -granularity 10 -milliseconds 0 -seconds 1214796621
% interp eval $i {expr 2**9999999}
The above script does not return even after the limit has elapsed.
| ||||
| User Comments: | ||||
mistachkin added on 2008-06-30 10:39:16:
Logged In: YES user_id=113501 Originator: YES This limitation applies to [interp cancel] as well. dkf added on 2008-07-13 15:41:20:
Logged In: YES user_id=79902 Originator: NO The only way to deal with this nicely is to add limit checks to the bignum engine. I don't know that we want to do that... dkf added on 2008-07-13 18:19:05:
Logged In: YES user_id=79902 Originator: NO BTW, on a fast modern machine where we're not running into swapping problems, that computation will take on the order of 10 minutes to perform, and that's excluding the cost of generating a string representation of it (which would probably be at least as long again). | ||||
