Message: Memory corruption when dealing with electromagnetic fields Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Warning Memory corruption when dealing with electromagnetic fields 

Forum: Fast Simulation, Transportation & Others
Date: 05 May, 2016
From: Jan C. Bernauer <Jan C. Bernauer>

It seems some function expect GetFieldValue to only write 3 doubles to the caller-provided pointer. Indeed some, for example user-defined electro-magnetic field classes write 6. This leads to memory corruption.

Attached is a patch which extends the caller provided arrays to be at least 6 entries long.

In general, the handling of that calling interface seems fishy. I haven't looked into this too carefully, but it seems that some classes only write 3 doubles. Which means the other 3 might be random, if the caller does not set them to zero.

   Attachment:
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2016/05/05/09.56-34930-fieldpatch.patch

 Add Message Add Message
to: "Memory corruption when dealing with electromagnetic fields"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]