Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/engine/engine_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ bool GlobalTable<mjpPlugin>::CopyObject(mjpPlugin& dst, const mjpPlugin& src, Er

// check and copy plugin attributes
std::unique_ptr<std::unique_ptr<char[]>[]> attributes_list;
if (src.nattribute) {
if (src.nattribute && src.nattribute <= kMaxAttributes) {
attributes_list.reset(new(std::nothrow) std::unique_ptr<char[]>[src.nattribute]);
if (!attributes_list) {
std::snprintf(err, sizeof(err), "failed to allocate memory for plugin attribute list");
Expand Down
2 changes: 1 addition & 1 deletion src/engine/engine_print.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ static bool validateFloatFormat(const char* float_format) {
// flag characters. allow at most one of each flag
const char flag_characters[] = "-+ #0";
int flag_character_counts[sizeof(flag_characters)] = { 0 };
char* c;
const char* c;
while (c = strchr(flag_characters, float_format[cur_idx]), c != NULL) {
int flag_idx = (c - flag_characters)/sizeof(char);
flag_character_counts[flag_idx]++;
Expand Down