Merge pull request #53211 from timothyqiu/request-ub

This commit is contained in:
Rémi Verschelde 2021-09-29 15:58:25 +02:00 committed by GitHub
commit 5e609d0e8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View file

@ -104,9 +104,11 @@ Error HTTPRequest::request(const String &p_url, const Vector<String> &p_custom_h
CharString charstr = p_request_data.utf8();
size_t len = charstr.length();
raw_data.resize(len);
uint8_t *w = raw_data.ptrw();
memcpy(w, charstr.ptr(), len);
if (len > 0) {
raw_data.resize(len);
uint8_t *w = raw_data.ptrw();
memcpy(w, charstr.ptr(), len);
}
return request_raw(p_url, p_custom_headers, p_ssl_validate_domain, p_method, raw_data);
}

View file

@ -249,8 +249,10 @@ void SoftBody3DSW::update_area() {
// Node area.
LocalVector<int> counts;
counts.resize(nodes.size());
memset(counts.ptr(), 0, counts.size() * sizeof(int));
if (nodes.size() > 0) {
counts.resize(nodes.size());
memset(counts.ptr(), 0, counts.size() * sizeof(int));
}
for (i = 0, ni = nodes.size(); i < ni; ++i) {
nodes[i].area = 0.0;