Problem 2473

Summary: Uninitialized memory in zlib
Product: Geant4 Reporter: Max Aehle <max.aehle>
Component: globalAssignee: Gunter.Folger
Status: ASSIGNED ---    
Severity: minor CC: max.aehle
Priority: P4    
Version: 10.7   
Hardware: PC   
OS: Linux   
URL: https://github.com/Geant4/geant4/pull/43

Description Max Aehle 2022-03-08 14:25:01 CET
See a more extensive description in my GitHub pull request https://github.com/Geant4/geant4/pull/43 .

zlib 1.2.11 sometimes operates on heap-allocated memory before initializing it. The externally-visible behaviour seems not to depend on the undefined content of the uninitialized memory, due to the higher-level program logic. However, the memory checker Valgrind reports this as an error. This is problematic as it might draw attention from true positives.

The proposed fix initializes the memory with zeros before using it.