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

Commit 9e2dc4d2 authored by kunal rai's avatar kunal rai
Browse files

a2dp_fuzz : Bug Fix

Corrected if condition in generateArbitrarySdpDiscAttr()

Test: ./a2dp_fuzz
Bug: 195847452

Change-Id: I696f0f6d2580631da98dc8a0dcc48646a4466986
parent fe1986fc
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@
#define SDP_MAX_ELEM_LEN 1024
#define SDP_MAX_ATTRS 1024

constexpr int32_t kMaxVectorSize = 1000;

struct SDP_Sequence_Helper {
  uint8_t num_elem;
  std::shared_ptr<uint8_t> type;
@@ -113,7 +115,8 @@ tSDP_DISC_ATVAL generateArbitrarySdpDiscAttrVal(FuzzedDataProvider* fdp) {
std::shared_ptr<tSDP_DISC_ATTR> generateArbitrarySdpDiscAttr(
    FuzzedDataProvider* fdp, bool allow_null) {
  // Give it a chance to return a nullptr
  if (allow_null && !fdp->ConsumeBool()) {
  if ((allow_null && !fdp->ConsumeBool()) ||
      sdp_disc_attr_vect.size() > kMaxVectorSize) {
    return nullptr;
  }