Date: Tue, 3 Nov 2026 21:44:17 +0000
On 03/11/2026 19:31, Thiago Macieira via Std-Proposals wrote:
> On Tuesday, 3 November 2026 10:48:55 Pacific Standard Time Rainer Deyke via
> Std-Proposals wrote:
>>> 2b) The correct image size is not known beforehand, but the overall system
>>> development group/team should have made sure that only working images are
>>> loaded. So it is neither the responsibility of the caller, nor the
>>> callee, but of the organisation.
>> The program should not make assumptions about its environment (beyond
>> "the CPU is working" and "memory bits don't flip randomly"). Correctly
>> sized externally stored images can and should be checked, ideally before
>> the plane takes off.
>
> Going off into the weeds here, but there are images and there are images.
>
> If the images being handled are all trusted, such as they all having been
> installed with the application or found in privileged paths, then some
> assumptions about their correctness are acceptable and could be implemented as
> preconditions in software. Content that is installed with the application can
> be trusted to be as secure as the code itself - if you can't trust the storage
> to retain integrity of the images, then you can't trust the storage to retain
> integrity of your code or constants in the first place. Heck, the Win32 API
> calls the executable format structs "IMAGE_SOMETHING" :-)
>
> If they are not trusted, then things change considerably.
>
>
Ok, let's assume that compressed images are not trusted.
A pre() contract cannot provide a recoverable error path for the application to handle these issues. If a contract violation ends up as std::terminate(), the airplane display finishes. A separate watchdog process then needs to restart it, but the same problem could immediately occur again because there is no recovery mechanism for a terminating pre() contract that somehow recorded which image file was invalid.
An alternative might be to run image decoding in a separate, isolated process. If that process terminates, the main application can detect the failure (for example, exit status 139 for SIGSEGV) and display a [noimage] placeholder.
This approach could be extended to other potentially risky processing, isolating in separate processes. At least the main application would remain operational and could fall back to a text-only display mode.
Regards
Jonathan
> On Tuesday, 3 November 2026 10:48:55 Pacific Standard Time Rainer Deyke via
> Std-Proposals wrote:
>>> 2b) The correct image size is not known beforehand, but the overall system
>>> development group/team should have made sure that only working images are
>>> loaded. So it is neither the responsibility of the caller, nor the
>>> callee, but of the organisation.
>> The program should not make assumptions about its environment (beyond
>> "the CPU is working" and "memory bits don't flip randomly"). Correctly
>> sized externally stored images can and should be checked, ideally before
>> the plane takes off.
>
> Going off into the weeds here, but there are images and there are images.
>
> If the images being handled are all trusted, such as they all having been
> installed with the application or found in privileged paths, then some
> assumptions about their correctness are acceptable and could be implemented as
> preconditions in software. Content that is installed with the application can
> be trusted to be as secure as the code itself - if you can't trust the storage
> to retain integrity of the images, then you can't trust the storage to retain
> integrity of your code or constants in the first place. Heck, the Win32 API
> calls the executable format structs "IMAGE_SOMETHING" :-)
>
> If they are not trusted, then things change considerably.
>
>
Ok, let's assume that compressed images are not trusted.
A pre() contract cannot provide a recoverable error path for the application to handle these issues. If a contract violation ends up as std::terminate(), the airplane display finishes. A separate watchdog process then needs to restart it, but the same problem could immediately occur again because there is no recovery mechanism for a terminating pre() contract that somehow recorded which image file was invalid.
An alternative might be to run image decoding in a separate, isolated process. If that process terminates, the main application can detect the failure (for example, exit status 139 for SIGSEGV) and display a [noimage] placeholder.
This approach could be extended to other potentially risky processing, isolating in separate processes. At least the main application would remain operational and could fall back to a text-only display mode.
Regards
Jonathan
Received on 2026-11-03 21:44:20
