Add proper exception handling in file descriptor enumeration

This commit is contained in:
Andrew Case
2025-02-07 13:14:11 -06:00
parent bf03ecda2c
commit d372f04eff
@@ -339,15 +339,23 @@ class LinuxUtilities(interfaces.configuration.VersionableInterface):
symbol_table: str,
task: interfaces.objects.ObjectInterface,
):
# task.files can be null
if not (task.files and task.files.is_readable()):
try:
files = task.files
except exceptions.InvalidAddressException:
return None
if not files.is_readable():
return None
try:
fd_table = files.get_fds()
except exceptions.InvalidAddressException:
return None
fd_table = task.files.get_fds()
if fd_table == 0:
return None
max_fds = task.files.get_max_fds()
max_fds = files.get_max_fds()
# corruption check
if max_fds > 500000: