From cedca0bb84b606b1962cb96fa562415d8ceb3636 Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Wed, 15 Jan 2020 21:55:30 +0000 Subject: [PATCH] Objects: Document void size a little more. --- volatility/framework/objects/__init__.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/volatility/framework/objects/__init__.py b/volatility/framework/objects/__init__.py index 59f4c4fa5..117157c76 100644 --- a/volatility/framework/objects/__init__.py +++ b/volatility/framework/objects/__init__.py @@ -8,7 +8,7 @@ import struct from collections import abc from typing import Any, ClassVar, Dict, List, Iterable, Optional, Tuple, Type, Union as TUnion, overload -from volatility.framework import interfaces +from volatility.framework import interfaces, constants from volatility.framework.objects import templates, utility vollog = logging.getLogger(__name__) @@ -71,7 +71,14 @@ class Void(interfaces.objects.ObjectInterface): @classmethod def size(cls, template: interfaces.objects.Template) -> int: - """Dummy size for Void objects.""" + """Dummy size for Void objects. + + According to http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf, void is an incomplete type, + and therefore sizeof(void) should fail. However, we need to be able to construct voids to be able to + cast them, so we return a useless size. It shouldn't cause errors, but it also shouldn't be common, + it is logged at the lowest level. + """ + vollog.log(constants.LOGLEVEL_VVVV, "Void size requested") return 0 def write(self, value: Any) -> None: