Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add proper exception handling in file descriptor enumeration #1514

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions volatility3/framework/symbols/linux/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,15 +307,23 @@ def files_descriptors_for_process(
symbol_table: str,
task: interfaces.objects.ObjectInterface,
):
# task.files can be null
if not (task.files and task.files.is_readable()):
try:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't need the exception handler setting up twice, all the calls can happen with the try/except and any failure within that block will result in a return None.

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:
Expand Down
Loading