Struct pointer out of Bound error despite using FromProto function to access

Hello ,

I have been trying to read Detections3proto message. I have first used FromProto function to obtain the boundingBox min and max. Later when I tried to use the same for obtaining Pose3d, I get out of bounds error.

Here is the code sample , describing my reading process.

const Quaterniond q = FromProto(detection_reader.getPoses().getRotation().getQ());
w, x, y, z = q.w(), q.x(), q.y(), q.z();

When used this I get the following error,

what(): capnp/layout.c++;2174: failed: expected boundsCheck’(segment, ptr, ref->structRef.wordsSize()); Message contained out of bounds struct pointer

can anyone please help me solve this . Thank you in advance