Skip to content

Commit f1fc79c

Browse files
committed
Add depth limit to variant_to_objc()
1 parent 1bbe21e commit f1fc79c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/sentry/cocoa/cocoa_util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ _FORCE_INLINE_ NSNumber *double_to_objc(double p_num) {
6666
return [NSNumber numberWithDouble:p_num];
6767
}
6868

69-
NSObject *variant_to_objc(const godot::Variant &p_value);
69+
NSObject *variant_to_objc(const godot::Variant &p_value, int p_depth = 0);
7070
NSDictionary *dictionary_to_objc(const godot::Dictionary &p_dictionary);
7171

7272
} //namespace sentry::cocoa

src/sentry/cocoa/cocoa_util.mm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44

55
namespace sentry::cocoa {
66

7-
NSObject *variant_to_objc(const godot::Variant &p_value) {
7+
NSObject *variant_to_objc(const godot::Variant &p_value, int p_depth) {
8+
if (p_depth > 32) {
9+
return [NSString stringWithUTF8String:"(Conversion depth limit reached)"];
10+
}
11+
812
switch (p_value.get_type()) {
913
case Variant::NIL: {
1014
return [NSNull null];

0 commit comments

Comments
 (0)