Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deserialization bug in persisted NDK errors #1220

Merged
merged 1 commit into from
Apr 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## TBD

### Bug fixes

* Fix deserialization bug in persisted NDK errors
[#1220](https://github.com/bugsnag/bugsnag-android/pull/1220)

## 5.9.0 (2021-03-30)

### Enhancements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import java.io.IOException
*/
class Notifier @JvmOverloads constructor(
var name: String = "Android Bugsnag Notifier",
var version: String = "5.9.0",
var version: String = "5.9.1",
var url: String = "https://bugsnag.com"
) : JsonStream.Streamable {

Expand Down
1 change: 0 additions & 1 deletion bugsnag-plugin-android-ndk/src/main/jni/utils/migrate.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ typedef struct {
time_t duration_ms_offset;
time_t duration_in_foreground_ms_offset;
bool in_foreground;
bool is_launching;
char binary_arch[32];
} bsg_app_info_v2;

Expand Down
39 changes: 39 additions & 0 deletions bugsnag-plugin-android-ndk/src/test/cpp/test_utils_serialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,44 @@ TEST test_breadcrumbs_to_json(void) {
PASS();
}

void migrate_app_v2(bugsnag_report_v4 *report_v4, bugsnag_event *event);

TEST test_migrate_app_v2(void) {
bugsnag_report_v4 *report_v4 = malloc(sizeof(bugsnag_report_v4));
bugsnag_event *event = malloc(sizeof(bugsnag_event));
bsg_app_info_v2 *seed = &report_v4->app;
bsg_app_info *app = &event->app;

strcpy(seed->id, "id");
strcpy(seed->release_stage, "beta");
strcpy(seed->type, "c");
strcpy(seed->version, "1.5.2");
strcpy(seed->active_screen, "ExampleActivity");
strcpy(seed->build_uuid, "10f9");
strcpy(seed->binary_arch, "x86");
seed->version_code = 5;
seed->duration = 52;
seed->duration_in_foreground = 25;
seed->duration_ms_offset = 3;
seed->duration_in_foreground_ms_offset = 11;

// migrate pre-populated data
migrate_app_v2(report_v4, event);

ASSERT_STR_EQ("id", app->id);
ASSERT_STR_EQ("beta", app->release_stage);
ASSERT_STR_EQ("c", app->type);
ASSERT_STR_EQ("1.5.2", app->version);
ASSERT_STR_EQ("ExampleActivity", app->active_screen);
ASSERT_STR_EQ("10f9", app->build_uuid);
ASSERT_STR_EQ("x86", app->binary_arch);
ASSERT_FALSE(app->is_launching);

free(report_v4);
free(event);
PASS();
}

SUITE(serialize_utils) {
RUN_TEST(test_report_to_file);
RUN_TEST(test_last_run_info_serialization);
Expand All @@ -532,4 +570,5 @@ SUITE(serialize_utils) {
RUN_TEST(test_custom_info_to_json);
RUN_TEST(test_exception_to_json);
RUN_TEST(test_breadcrumbs_to_json);
RUN_TEST(test_migrate_app_v2);
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ org.gradle.jvmargs=-Xmx4096m
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true
VERSION_NAME=5.9.0
VERSION_NAME=5.9.1
GROUP=com.bugsnag
POM_SCM_URL=https://github.com/bugsnag/bugsnag-android
POM_SCM_CONNECTION=scm:[email protected]:bugsnag/bugsnag-android.git
Expand Down