Skip to content

Commit

Permalink
validating core objects property keys on load
Browse files Browse the repository at this point in the history
this should fix fuzz crashes caught from bad animation keys

Diffs=
8a538c243 validating core objects property keys on load (#7298)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
  • Loading branch information
luigi-rosso and luigi-rosso committed May 22, 2024
1 parent 61d6fbb commit 35f22ae
Show file tree
Hide file tree
Showing 4 changed files with 559 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cd6210f42d644de3cc1c83fa65b3d4e1f790cece
8a538c243fcc5b72159388a7e63669f1e6998dda
16 changes: 16 additions & 0 deletions dev/core_generator/lib/src/definition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,22 @@ class Definition {
ctxCode.writeln('default:return false;');
ctxCode.writeln('}}');

// static bool objectSupportsProperty(Core* object, uint32_t propertyKey) { return true; }
ctxCode.writeln('''
static bool objectSupportsProperty(Core* object, uint32_t propertyKey) {
switch(propertyKey) {''');
for (final fieldType in usedFieldTypes.keys) {
var properties = getSetFieldTypes[fieldType];
if (properties != null) {
for (final property in properties) {
ctxCode.writeln('case ${property.definition.name}Base'
'::${property.name}PropertyKey:');
ctxCode
.writeln('return object->is<${property.definition.name}Base>();');
}
}
}
ctxCode.writeln('}return false;}');
ctxCode.writeln('};}');

var output = generatedHppPath;
Expand Down
Loading

0 comments on commit 35f22ae

Please sign in to comment.