Skip to content

Commit 0f3df6f

Browse files
committed
v3.5.5
1 parent 0a122d7 commit 0f3df6f

File tree

12 files changed

+62
-40
lines changed

12 files changed

+62
-40
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 3.5.5 (2017-11-30)
4+
* (iOS) Fix encoding of control characters in crash reports. Ensures crash reports are
5+
written correctly and delivered when containing U+0000 - U+001F
6+
37
## 3.5.4 (2017-11-23)
48

59
* (iOS) Use `BSG_KSCrashReportWriter` header rather than `KSCrashReportWriter` for custom JSON serialization

bugsnag-android-unity/src/main/java/com/bugsnag/android/unity/UnityCallback.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class UnityCallback implements Callback {
88
static final String NOTIFIER_NAME = "Bugsnag Unity (Android)";
9-
static final String NOTIFIER_VERSION = "3.5.4";
9+
static final String NOTIFIER_VERSION = "3.5.5";
1010
static final String NOTIFIER_URL = "https://github.com/bugsnag/bugsnag-unity";
1111

1212
private final String context;
Binary file not shown.
0 Bytes
Binary file not shown.

example/Assets/Plugins/OSX/Bugsnag/bugsnag-osx.bundle/Contents/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<plist version="1.0">
44
<dict>
55
<key>BuildMachineOSBuild</key>
6-
<string>17A405</string>
6+
<string>17B1003</string>
77
<key>CFBundleDevelopmentRegion</key>
88
<string>en</string>
99
<key>CFBundleExecutable</key>
Binary file not shown.

example/Assets/Plugins/iOS/Bugsnag/BSG_KSCrashReport.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,12 @@ void bsg_kscrw_i_writeUnknownObjectContents(
781781
*limit -= (int)ivarCount;
782782
for (size_t i = 0; i < ivarCount; i++) {
783783
BSG_KSObjCIvar *ivar = &ivars[i];
784+
785+
if (ivar->type == NULL) {
786+
BSG_KSLOG_ERROR("Found null ivar :(");
787+
continue;
788+
}
789+
784790
switch (ivar->type[0]) {
785791
case 'c':
786792
bsg_ksobjc_ivarValue(object, ivar->index, &s8);

example/Assets/Plugins/iOS/Bugsnag/BSG_KSJSONCodec.c

Lines changed: 46 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@
4343
#if BSG_KSJSONCODEC_UseKSLogger
4444
#include "BSG_KSLogger.h"
4545
#else
46-
#define BSG_KSLOG_DEBUG(FMT, ...)
46+
#define BSG_KSLOG_ERROR(FMT, ...)
4747
#endif
4848

49+
4950
/** The work buffer size to use when escaping string values.
5051
* There's little reason to change this since nothing ever gets truncated.
5152
*/
@@ -125,7 +126,7 @@ int bsg_ksjsoncodec_i_appendEscapedString(
125126
src++) {
126127
*dst++ = *src;
127128
}
128-
129+
129130
// Deal with complicated case (if any)
130131
for (; src < srcEnd; src++) {
131132
switch (*src) {
@@ -155,12 +156,23 @@ int bsg_ksjsoncodec_i_appendEscapedString(
155156
*dst++ = 't';
156157
break;
157158
default:
158-
unlikely_if((unsigned char)*src < ' ') {
159-
BSG_KSLOG_DEBUG("Invalid character 0x%02x in string: %s", *src,
160-
string);
161-
return BSG_KSJSON_ERROR_INVALID_CHARACTER;
159+
160+
// escape control chars (U+0000 - U+001F)
161+
// see https://www.ietf.org/rfc/rfc4627.txt
162+
163+
if ((unsigned char)*src < ' ') {
164+
unsigned int last = *src % 16;
165+
unsigned int first = (*src - last) / 16;
166+
167+
*dst++ = '\\';
168+
*dst++ = 'u';
169+
*dst++ = '0';
170+
*dst++ = '0';
171+
*dst++ = bsg_g_hexNybbles[first];
172+
*dst++ = bsg_g_hexNybbles[last];
173+
} else {
174+
*dst++ = *src;
162175
}
163-
*dst++ = *src;
164176
}
165177
}
166178
size_t encLength = (size_t)(dst - workBuffer);
@@ -252,7 +264,7 @@ int bsg_ksjsonbeginElement(BSG_KSJSONEncodeContext *const context,
252264
// Add a name field if we're in an object.
253265
if (context->isObject[context->containerLevel]) {
254266
unlikely_if(name == NULL) {
255-
BSG_KSLOG_DEBUG("Name was null inside an object");
267+
BSG_KSLOG_ERROR("Name was null inside an object");
256268
return BSG_KSJSON_ERROR_INVALID_DATA;
257269
}
258270
unlikely_if((result = bsg_ksjsoncodec_i_addQuotedEscapedString(
@@ -323,7 +335,7 @@ int bsg_ksjsonaddJSONElement(BSG_KSJSONEncodeContext *const context,
323335
idx++;
324336
}
325337
unlikely_if(idx >= length) {
326-
BSG_KSLOG_DEBUG("JSON element contained no JSON data: %s", element);
338+
BSG_KSLOG_ERROR("JSON element contained no JSON data: %s", element);
327339
return BSG_KSJSON_ERROR_INVALID_DATA;
328340
}
329341
switch (element[idx]) {
@@ -346,7 +358,7 @@ int bsg_ksjsonaddJSONElement(BSG_KSJSONEncodeContext *const context,
346358
case '9':
347359
break;
348360
default:
349-
BSG_KSLOG_DEBUG("Invalid character '%c' in: ", element[idx], element);
361+
BSG_KSLOG_ERROR("Invalid character '%c' in: ", element[idx], element);
350362
return BSG_KSJSON_ERROR_INVALID_DATA;
351363
}
352364

@@ -656,14 +668,14 @@ int bsg_ksjsoncodec_i_writeUTF8(unsigned int character, char **dst) {
656668
}
657669

658670
// If we get here, the character cannot be converted to valid UTF-8.
659-
BSG_KSLOG_DEBUG("Invalid unicode: 0x%04x", character);
671+
BSG_KSLOG_ERROR("Invalid unicode: 0x%04x", character);
660672
return BSG_KSJSON_ERROR_INVALID_CHARACTER;
661673
}
662674

663675
int bsg_ksjsoncodec_i_decodeString(const char **ptr, const char *const end,
664676
char **dstString) {
665677
unlikely_if(**ptr != '\"') {
666-
BSG_KSLOG_DEBUG("Expected '\"' but got '%c'", **ptr);
678+
BSG_KSLOG_ERROR("Expected '\"' but got '%c'", **ptr);
667679
return BSG_KSJSON_ERROR_INVALID_CHARACTER;
668680
}
669681

@@ -677,7 +689,7 @@ int bsg_ksjsoncodec_i_decodeString(const char **ptr, const char *const end,
677689
}
678690
}
679691
unlikely_if(src >= end) {
680-
BSG_KSLOG_DEBUG("Premature end of data");
692+
BSG_KSLOG_ERROR("Premature end of data");
681693
return BSG_KSJSON_ERROR_INCOMPLETE;
682694
}
683695
const char *const srcEnd = src;
@@ -729,7 +741,7 @@ int bsg_ksjsoncodec_i_decodeString(const char **ptr, const char *const end,
729741
continue;
730742
case 'u': {
731743
unlikely_if(src + 5 > srcEnd) {
732-
BSG_KSLOG_DEBUG("Premature end of data");
744+
BSG_KSLOG_ERROR("Premature end of data");
733745
result = BSG_KSJSON_ERROR_INCOMPLETE;
734746
goto failed;
735747
}
@@ -738,15 +750,15 @@ int bsg_ksjsoncodec_i_decodeString(const char **ptr, const char *const end,
738750
bsg_g_hexConversion[src[3]] << 4 |
739751
bsg_g_hexConversion[src[4]];
740752
unlikely_if(accum > 0xffff) {
741-
BSG_KSLOG_DEBUG("Invalid unicode sequence: %c%c%c%c",
753+
BSG_KSLOG_ERROR("Invalid unicode sequence: %c%c%c%c",
742754
src[1], src[2], src[3], src[4]);
743755
result = BSG_KSJSON_ERROR_INVALID_CHARACTER;
744756
goto failed;
745757
}
746758

747759
// UTF-16 Trail surrogate on its own.
748760
unlikely_if(accum >= 0xdc00 && accum <= 0xdfff) {
749-
BSG_KSLOG_DEBUG("Unexpected trail surrogate: 0x%04x",
761+
BSG_KSLOG_ERROR("Unexpected trail surrogate: 0x%04x",
750762
accum);
751763
result = BSG_KSJSON_ERROR_INVALID_CHARACTER;
752764
goto failed;
@@ -756,12 +768,12 @@ int bsg_ksjsoncodec_i_decodeString(const char **ptr, const char *const end,
756768
unlikely_if(accum >= 0xd800 && accum <= 0xdbff) {
757769
// Fetch trail surrogate.
758770
unlikely_if(src + 11 > srcEnd) {
759-
BSG_KSLOG_DEBUG("Premature end of data");
771+
BSG_KSLOG_ERROR("Premature end of data");
760772
result = BSG_KSJSON_ERROR_INCOMPLETE;
761773
goto failed;
762774
}
763775
unlikely_if(src[5] != '\\' || src[6] != 'u') {
764-
BSG_KSLOG_DEBUG("Expected \"\\u\" but got: \"%c%c\"",
776+
BSG_KSLOG_ERROR("Expected \"\\u\" but got: \"%c%c\"",
765777
src[5], src[6]);
766778
result = BSG_KSJSON_ERROR_INVALID_CHARACTER;
767779
goto failed;
@@ -772,7 +784,7 @@ int bsg_ksjsoncodec_i_decodeString(const char **ptr, const char *const end,
772784
bsg_g_hexConversion[src[3]] << 4 |
773785
bsg_g_hexConversion[src[4]];
774786
unlikely_if(accum2 < 0xdc00 || accum2 > 0xdfff) {
775-
BSG_KSLOG_DEBUG("Invalid trail surrogate: 0x%04x",
787+
BSG_KSLOG_ERROR("Invalid trail surrogate: 0x%04x",
776788
accum2);
777789
result = BSG_KSJSON_ERROR_INVALID_CHARACTER;
778790
goto failed;
@@ -787,7 +799,7 @@ int bsg_ksjsoncodec_i_decodeString(const char **ptr, const char *const end,
787799
continue;
788800
}
789801
default:
790-
BSG_KSLOG_DEBUG("Invalid control character '%c'", *src);
802+
BSG_KSLOG_ERROR("Invalid control character '%c'", *src);
791803
result = BSG_KSJSON_ERROR_INVALID_CHARACTER;
792804
goto failed;
793805
}
@@ -811,7 +823,7 @@ int bsg_ksjsoncodec_i_decodeElement(const char **ptr, const char *const end,
811823
void *const userData) {
812824
skipWhitespace(ptr, end);
813825
unlikely_if(*ptr >= end) {
814-
BSG_KSLOG_DEBUG("Premature end of data");
826+
BSG_KSLOG_ERROR("Premature end of data");
815827
return BSG_KSJSON_ERROR_INCOMPLETE;
816828
}
817829

@@ -837,7 +849,7 @@ int bsg_ksjsoncodec_i_decodeElement(const char **ptr, const char *const end,
837849
unlikely_if(*ptr >= end) { break; }
838850
likely_if(**ptr == ',') { (*ptr)++; }
839851
}
840-
BSG_KSLOG_DEBUG("Premature end of data");
852+
BSG_KSLOG_ERROR("Premature end of data");
841853
return BSG_KSJSON_ERROR_INCOMPLETE;
842854
}
843855
case '{': {
@@ -861,7 +873,7 @@ int bsg_ksjsoncodec_i_decodeElement(const char **ptr, const char *const end,
861873
}
862874
unlikely_if(**ptr != ':') {
863875
free(key);
864-
BSG_KSLOG_DEBUG("Expected ':' but got '%c'", **ptr);
876+
BSG_KSLOG_ERROR("Expected ':' but got '%c'", **ptr);
865877
return BSG_KSJSON_ERROR_INVALID_CHARACTER;
866878
}
867879
(*ptr)++;
@@ -874,7 +886,7 @@ int bsg_ksjsoncodec_i_decodeElement(const char **ptr, const char *const end,
874886
unlikely_if(*ptr >= end) { break; }
875887
likely_if(**ptr == ',') { (*ptr)++; }
876888
}
877-
BSG_KSLOG_DEBUG("Premature end of data");
889+
BSG_KSLOG_ERROR("Premature end of data");
878890
return BSG_KSJSON_ERROR_INCOMPLETE;
879891
}
880892
case '\"': {
@@ -887,12 +899,12 @@ int bsg_ksjsoncodec_i_decodeElement(const char **ptr, const char *const end,
887899
}
888900
case 'f': {
889901
unlikely_if(end - *ptr < 5) {
890-
BSG_KSLOG_DEBUG("Premature end of data");
902+
BSG_KSLOG_ERROR("Premature end of data");
891903
return BSG_KSJSON_ERROR_INCOMPLETE;
892904
}
893905
unlikely_if(!((*ptr)[1] == 'a' && (*ptr)[2] == 'l' &&
894906
(*ptr)[3] == 's' && (*ptr)[4] == 'e')) {
895-
BSG_KSLOG_DEBUG("Expected \"false\" but got \"f%c%c%c%c\"",
907+
BSG_KSLOG_ERROR("Expected \"false\" but got \"f%c%c%c%c\"",
896908
(*ptr)[1], (*ptr)[2], (*ptr)[3], (*ptr)[4]);
897909
return BSG_KSJSON_ERROR_INVALID_CHARACTER;
898910
}
@@ -901,12 +913,12 @@ int bsg_ksjsoncodec_i_decodeElement(const char **ptr, const char *const end,
901913
}
902914
case 't': {
903915
unlikely_if(end - *ptr < 4) {
904-
BSG_KSLOG_DEBUG("Premature end of data");
916+
BSG_KSLOG_ERROR("Premature end of data");
905917
return BSG_KSJSON_ERROR_INCOMPLETE;
906918
}
907919
unlikely_if(
908920
!((*ptr)[1] == 'r' && (*ptr)[2] == 'u' && (*ptr)[3] == 'e')) {
909-
BSG_KSLOG_DEBUG("Expected \"true\" but got \"t%c%c%c\"", (*ptr)[1],
921+
BSG_KSLOG_ERROR("Expected \"true\" but got \"t%c%c%c\"", (*ptr)[1],
910922
(*ptr)[2], (*ptr)[3]);
911923
return BSG_KSJSON_ERROR_INVALID_CHARACTER;
912924
}
@@ -915,12 +927,12 @@ int bsg_ksjsoncodec_i_decodeElement(const char **ptr, const char *const end,
915927
}
916928
case 'n': {
917929
unlikely_if(end - *ptr < 4) {
918-
BSG_KSLOG_DEBUG("Premature end of data");
930+
BSG_KSLOG_ERROR("Premature end of data");
919931
return BSG_KSJSON_ERROR_INCOMPLETE;
920932
}
921933
unlikely_if(
922934
!((*ptr)[1] == 'u' && (*ptr)[2] == 'l' && (*ptr)[3] == 'l')) {
923-
BSG_KSLOG_DEBUG("Expected \"null\" but got \"n%c%c%c\"", (*ptr)[1],
935+
BSG_KSLOG_ERROR("Expected \"null\" but got \"n%c%c%c\"", (*ptr)[1],
924936
(*ptr)[2], (*ptr)[3]);
925937
return BSG_KSJSON_ERROR_INVALID_CHARACTER;
926938
}
@@ -931,7 +943,7 @@ int bsg_ksjsoncodec_i_decodeElement(const char **ptr, const char *const end,
931943
sign = -1;
932944
(*ptr)++;
933945
unlikely_if(!isdigit(**ptr)) {
934-
BSG_KSLOG_DEBUG("Not a digit: '%c'", **ptr);
946+
BSG_KSLOG_ERROR("Not a digit: '%c'", **ptr);
935947
return BSG_KSJSON_ERROR_INVALID_CHARACTER;
936948
}
937949
// Fall through
@@ -958,7 +970,7 @@ int bsg_ksjsoncodec_i_decodeElement(const char **ptr, const char *const end,
958970
}
959971

960972
unlikely_if(*ptr >= end) {
961-
BSG_KSLOG_DEBUG("Premature end of data");
973+
BSG_KSLOG_ERROR("Premature end of data");
962974
return BSG_KSJSON_ERROR_INCOMPLETE;
963975
}
964976

@@ -972,7 +984,7 @@ int bsg_ksjsoncodec_i_decodeElement(const char **ptr, const char *const end,
972984
}
973985

974986
unlikely_if(*ptr >= end) {
975-
BSG_KSLOG_DEBUG("Premature end of data");
987+
BSG_KSLOG_ERROR("Premature end of data");
976988
return BSG_KSJSON_ERROR_INCOMPLETE;
977989
}
978990

@@ -993,7 +1005,7 @@ int bsg_ksjsoncodec_i_decodeElement(const char **ptr, const char *const end,
9931005
return callbacks->onFloatingPointElement(name, value, userData);
9941006
}
9951007
}
996-
BSG_KSLOG_DEBUG("Invalid character '%c'", **ptr);
1008+
BSG_KSLOG_ERROR("Invalid character '%c'", **ptr);
9971009
return BSG_KSJSON_ERROR_INVALID_CHARACTER;
9981010
}
9991011

example/Assets/Plugins/iOS/Bugsnag/BugsnagNotifier.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
#import <AppKit/AppKit.h>
4444
#endif
4545

46-
NSString *const NOTIFIER_VERSION = @"5.14.0";
46+
NSString *const NOTIFIER_VERSION = @"5.14.1";
4747
NSString *const NOTIFIER_URL = @"https://github.com/bugsnag/bugsnag-cocoa";
4848
NSString *const BSTabCrash = @"crash";
4949
NSString *const BSAttributeDepth = @"depth";

0 commit comments

Comments
 (0)