Skip to content

Commit

Permalink
ECC-1994: Crash: grib_compare combining -b and -r flag
Browse files Browse the repository at this point in the history
  • Loading branch information
shahramn committed Dec 13, 2024
1 parent 9dc994b commit 67d1bad
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/accessor/grib_accessor_class_md5.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ int grib_accessor_md5_t::unpack_string(char* v, size_t* len)
mess = (unsigned char*)grib_context_malloc(context_, length);
memcpy(mess, grib_handle_of_accessor(this)->buffer->data + offset, length);
mess_len = length;
const unsigned char* pEnd = mess + length - 1;

blocklist = context_->blocklist;
/* passed blocklist overrides context blocklist.
Expand All @@ -117,8 +118,10 @@ int grib_accessor_md5_t::unpack_string(char* v, size_t* len)
}

p = mess + b->offset_ - offset;
for (i = 0; i < b->length_; i++)
for (i = 0; i < b->length_; i++) {
if (p > pEnd) break;
*(p++) = 0;
}

blocklist = blocklist->next;
}
Expand Down

0 comments on commit 67d1bad

Please sign in to comment.