infodwarf using lots of CPU, due to missing error check / patch
Original Reporter info from Mantis: Martin @martin_frb
-
Reporter name: Martin Friebe
Original Reporter info from Mantis: Martin @martin_frb
- Reporter name: Martin Friebe
Description:
In function ParseCompilationUnit line 579 / trunk (form within last 7 days)
extended_opcode_length := ReadULEB128();
....
for i := 0 to extended_opcode_length-2 do
ReadNext();
I have a case where that goes wrong. the length is well over 1 million (obviously wrong)
In the loop there is no check, if "ReadNext" has failed. So it fails over a million times (can take several minutes or longer)
I propose to add 2 checks, for the result of "ReadNext". (See attached patch)
Exit should be save, as the var param "found" must be false in both cases. But if it is prefered, then code could be modified to set a flag (in the for loop), and then "break" the while loop.
Mantis conversion info:
- Mantis ID: 24900
- OS: win
- OS Build: vista
- Platform: w32
- Version: 2.7.1
- Fixed in version: 3.0.0
- Fixed in revision: 26814 (#d91da3bd)
- Monitored by: » Vincent (Vincent Snijders)