NativeScript / android

NativeScript for Android using v8
https://docs.nativescript.org/guide/android-marshalling
Apache License 2.0
519 stars 135 forks source link

fix: possible infinite loop and memory leak in metadata reader #1749

Closed edusperoni closed 1 year ago

edusperoni commented 1 year ago

Description

Previsouly we used if (childNodeDataId == childNodeData->nextSiblingId) { as a breaking out of the loop.

Usually this is fine, as it's generated A->B->C->C. The issue is that in some very specific scenarios the metadata will generate:

A->B->C->B

Which will generate an infinite loop.

Additionally, It's not uncommon to have:

A->B->C->F
D->E->F

Which would generate:

A->B->C->F (break)
D->E->F (break)

but since F already exists, then it would leak a MetadataTreeNode