Skip to content

Commit e36106c

Browse files
authored
fix(ios16-beta5): errors and crash (#179)
1 parent 3720b2b commit e36106c

File tree

6 files changed

+14
-9
lines changed

6 files changed

+14
-9
lines changed

NativeScript/NativeScript-Prefix.pch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef NativeScript_Prefix_pch
22
#define NativeScript_Prefix_pch
33

4-
#define NATIVESCRIPT_VERSION "8.3.2"
4+
#define NATIVESCRIPT_VERSION "8.3.3-alpha.0"
55

66
#ifdef DEBUG
77
#define SIZEOF_OFF_T 8

NativeScript/runtime/ExtVector.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void ExtVector::RegisterToStringMethod(Isolate* isolate, Local<ObjectTemplate> p
8080
void* value = wrapper->Data();
8181

8282
char buffer[100];
83-
sprintf(buffer, "<Vector: %p>", value);
83+
snprintf(buffer, 100, "<Vector: %p>", value);
8484

8585
Local<v8::String> result = tns::ToV8String(isolate, buffer);
8686
info.GetReturnValue().Set(result);

NativeScript/runtime/Metadata.mm

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,12 @@ static UInt8 getSystemVersion() {
7676

7777
auto it = sampleInstances.find(klass);
7878
if (it == sampleInstances.end()) {
79-
it = sampleInstances.emplace(klass, [klass alloc]).first;
79+
@try {
80+
it = sampleInstances.emplace(klass, [klass alloc]).first;
81+
}
82+
@catch(id err) {
83+
return false;
84+
}
8085
}
8186
id sampleInstance = it->second;
8287
return [sampleInstance respondsToSelector:this->selector()];

NativeScript/runtime/Pointer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ void Pointer::RegisterToStringMethod(Local<Context> context, Local<Object> proto
179179
void* value = wrapper->Data();
180180

181181
char buffer[100];
182-
sprintf(buffer, "<Pointer: %p>", value);
182+
snprintf(buffer, 100, "<Pointer: %p>", value);
183183

184184
Local<v8::String> result = tns::ToV8String(isolate, buffer);
185185
info.GetReturnValue().Set(result);
@@ -200,7 +200,7 @@ void Pointer::RegisterToHexStringMethod(Local<Context> context, Local<Object> pr
200200
const void* value = wrapper->Data();
201201

202202
char buffer[100];
203-
sprintf(buffer, "%p", value);
203+
snprintf(buffer, 100, "%p", value);
204204

205205
Local<v8::String> result = tns::ToV8String(isolate, buffer);
206206
info.GetReturnValue().Set(result);
@@ -222,7 +222,7 @@ void Pointer::RegisterToDecimalStringMethod(Local<Context> context, Local<Object
222222
intptr_t ptr = static_cast<intptr_t>(reinterpret_cast<size_t>(value));
223223

224224
char buffer[100];
225-
sprintf(buffer, "%ld", ptr);
225+
snprintf(buffer, 100, "%ld", ptr);
226226

227227
Local<v8::String> result = tns::ToV8String(isolate, buffer);
228228
info.GetReturnValue().Set(result);

NativeScript/runtime/Reference.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,9 @@ void Reference::RegisterToStringMethod(Local<Context> context, Local<Object> pro
295295

296296
char buffer[100];
297297
if (value == nullptr) {
298-
sprintf(buffer, "<Reference: %p>", reinterpret_cast<void*>(0));
298+
snprintf(buffer, 100, "<Reference: %p>", reinterpret_cast<void*>(0));
299299
} else {
300-
sprintf(buffer, "<Reference: %p>", value);
300+
snprintf(buffer, 100, "<Reference: %p>", value);
301301
}
302302

303303
Local<v8::String> result = tns::ToV8String(isolate, buffer);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@nativescript/ios",
33
"description": "NativeScript Runtime for iOS",
4-
"version": "8.3.2",
4+
"version": "8.3.3-alpha.0",
55
"keywords": [
66
"NativeScript",
77
"iOS",

0 commit comments

Comments
 (0)