NNAPI: validate that FmqResultDatum padding is 0 -- runtime

FmqResultDatum::OperandInformation has padding that may not be
initialized by an NN HAL service instance. This CL makes
adjustments to ensure padding values entering and leaving the
FMQ are preserved. This CL also makes a private method public
for easier security testing.

Bug: 131356202
Test: mma
Test: atest VtsHalNeuralnetworksV1_2TargetTest
      (for ValidationTest with sample-all)
Test: altered sample-driver to randomly set a padding byte to 1;
      the new validation test successfully failed the test

Change-Id: Idd5af092ff838dc13ccd022b48b4f16661b40474
diff --git a/nn/common/ExecutionBurstServer.cpp b/nn/common/ExecutionBurstServer.cpp
index e9dc179..7139899 100644
--- a/nn/common/ExecutionBurstServer.cpp
+++ b/nn/common/ExecutionBurstServer.cpp
@@ -20,6 +20,7 @@
 
 #include <android-base/logging.h>
 
+#include <cstring>
 #include <limits>
 #include <map>
 
@@ -368,7 +369,7 @@
     // are also available.
     const size_t count = mFmqRequestChannel->availableToRead();
     std::vector<FmqRequestDatum> packet(count + 1);
-    packet.front() = datum;
+    std::memcpy(&packet.front(), &datum, sizeof(datum));
     success &= mFmqRequestChannel->read(packet.data() + 1, count);
 
     // terminate loop
@@ -382,7 +383,7 @@
         return std::nullopt;
     }
 
-    return packet;
+    return std::make_optional(std::move(packet));
 }
 
 // ResultChannelSender methods