Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d6a59962 authored by S Vasudev Prasad's avatar S Vasudev Prasad
Browse files

Fix Stack-use-after-scope error in C2Fuzzer

In C2Fuzzer, configuration parameters C2StreamPictureSizeInfo::input,
C2StreamSampleRateInfo::output and C2StreamChannelCountInfo::output
were declared as stack variables which lead to the errors. These
are now declared on heap and freed later

Bug: 191341806
Test: Tested with ASAN:
      Stack-use-after-scope error without the fix and
      no errors reported with fix

Change-Id: Ic6d981668143d253e2ef52f5c273fc754d602db0
parent 086eb84e
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -194,12 +194,12 @@ bool Codec2Fuzzer::initDecoder() {
  }

  std::vector<C2Param*> configParams;
  if (domain.value == DOMAIN_VIDEO) {
  C2StreamPictureSizeInfo::input inputSize(0u, kWidthOfVideo, kHeightOfVideo);
    configParams.push_back(&inputSize);
  } else if (domain.value == DOMAIN_AUDIO) {
  C2StreamSampleRateInfo::output sampleRateInfo(0u, kSamplingRateOfAudio);
  C2StreamChannelCountInfo::output channelCountInfo(0u, kChannelsOfAudio);
  if (domain.value == DOMAIN_VIDEO) {
    configParams.push_back(&inputSize);
  } else if (domain.value == DOMAIN_AUDIO) {
    configParams.push_back(&sampleRateInfo);
    configParams.push_back(&channelCountInfo);
  }