CSharp: fix LDKStr array decoding
authorAfshin Arani <afshin@arani.dev>
Sun, 10 Mar 2024 10:40:17 +0000 (12:40 +0200)
committerAfshin Arani <afshin@arani.dev>
Sun, 10 Mar 2024 10:49:27 +0000 (12:49 +0200)
commitdbcef74f9feb03aa6d8d0ee07854740cac926f6b
tree677f3088c8f40e558951f751c2bd8c8b373b5103
parentcb6890a47e847e5b858d91b5d2be6c15c564252a
CSharp: fix LDKStr array decoding

Strings are encoded as array of string references, those references
are actually pointers to the string location and have 64bit in size,
but decoding logic was decoding those pointers as 32bit which caused
the following exception, this commit fixes that.

Exception:

Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at InternalUtils.getArrayLength(Int64)
   at InternalUtils.decodeUint8Array(Int64)
   at InternalUtils.decodeString(Int64)
   at org.ldk.structs.Result_CVec_StrZIOErrorZ+Result_CVec_StrZIOErrorZ_OK..ctor(System.Object, Int64)
   at org.ldk.structs.Result_CVec_StrZIOErrorZ.constr_from_ptr(Int64)
   at org.ldk.structs.KVStore.list(System.String, System.String)
c_sharp/src/org/ldk/structs/Bolt11Invoice.cs
c_sharp/src/org/ldk/structs/Result_CVec_StrZIOErrorZ.cs
csharp_strings.py