Skip to content

Commit

Permalink
Merge pull request #1927 from bugsnag/release/v5.31.3
Browse files Browse the repository at this point in the history
v5.31.3
  • Loading branch information
SmartbearYing authored Nov 6, 2023
2 parents be4c02a + 77af767 commit 0f2075b
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 13 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/downstream_updates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: downstream-updates

on:
release:
types: [released]
workflow_dispatch:
inputs:
target_version:
description: 'Version of the submodule to update downstream repos to'
required: true
type: string

jobs:
update-dependencies:
runs-on: ubuntu-latest
env:
RELEASE_VERSION: ${{ github.event_name == 'workflow_dispatch' && inputs.target_version || github.event.release.tag_name }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
matrix:
downstream_repo: ['bugsnag/bugsnag-unity']
steps:
- name: Install libcurl4-openssl-dev and net-tools
run: |
sudo apt-get update
sudo apt-get install libcurl4-openssl-dev net-tools
- run: >
curl -X POST https://api.github.com/repos/${{ matrix.downstream_repo }}/dispatches
-H 'Content-Type: application/json'
-H "Authorization: Bearer $GITHUB_TOKEN"
-d '{"event_type":"update-dependency","client_payload": {"target_submodule":"bugsnag-android", "target_version": "$RELEASE_VERSION"}}'
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 5.31.3 (2023-11-06)

### Bug fixes

* Handle cases in NDK when `GetStringUTFChars` fails for callback names
[#1918](https://github.com/bugsnag/bugsnag-android/pull/1918)

## 5.31.2 (2023-10-11)

### Bug fixes
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.31.2",
var version: String = "5.31.3",
var url: String = "https://bugsnag.com"
) : JsonStream.Streamable {

Expand Down
10 changes: 10 additions & 0 deletions bugsnag-plugin-android-ndk/src/main/jni/bugsnag_ndk.c
Original file line number Diff line number Diff line change
Expand Up @@ -955,14 +955,24 @@ Java_com_bugsnag_android_ndk_NativeBridge_notifyAddCallback(JNIEnv *env,
jobject thiz,
jstring callback_) {
const char *callback = bsg_safe_get_string_utf_chars(env, callback_);
if (!callback) {
return;
}

bsg_notify_add_callback(&bsg_global_env->next_event, callback);
bsg_safe_release_string_utf_chars(env, callback_, callback);
}

JNIEXPORT void JNICALL
Java_com_bugsnag_android_ndk_NativeBridge_notifyRemoveCallback(
JNIEnv *env, jobject thiz, jstring callback_) {
const char *callback = bsg_safe_get_string_utf_chars(env, callback_);
if (!callback) {
return;
}

bsg_notify_remove_callback(&bsg_global_env->next_event, callback);
bsg_safe_release_string_utf_chars(env, callback_, callback);
}

JNIEXPORT void JNICALL
Expand Down
20 changes: 11 additions & 9 deletions bugsnag-plugin-android-ndk/src/main/jni/internal_metrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,26 +130,28 @@ static void bsg_modify_callback_count(bugsnag_event *event, const char *api,
int delta) {
static const int total_callbacks =
sizeof(event->set_callback_counts) / sizeof(*event->set_callback_counts);
if (strlen(api) >= sizeof(event->set_callback_counts[0].name)) {
// API name is too big to store.
if (!api || strnlen(api, sizeof(event->set_callback_counts[0].name)) >=
sizeof(event->set_callback_counts[0].name)) {
// API name is NULL or is too big to store.
return;
}

int i = 0;
for (; i < total_callbacks && event->set_callback_counts[i].name[0] != 0;
i++) {
if (strcmp(event->set_callback_counts[i].name, api) == 0) {
event->set_callback_counts[i].count += delta;
if (event->set_callback_counts[i].count < 0) {
event->set_callback_counts[i].count = 0;
set_callback_count *callback_counter = &event->set_callback_counts[i];
if (strcmp(callback_counter->name, api) == 0) {
callback_counter->count += delta;
if (callback_counter->count < 0) {
callback_counter->count = 0;
}
return;
}
}
if (i < total_callbacks && delta > 0) {
strncpy(event->set_callback_counts[i].name, api,
sizeof(event->set_callback_counts[i].name));
event->set_callback_counts[i].count = delta;
set_callback_count *callback_counter = &event->set_callback_counts[i];
strncpy(callback_counter->name, api, sizeof(callback_counter->name));
callback_counter->count = delta;
}
}

Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ x-common-environment: &common-environment
BUILDKITE_BUILD_CREATOR:
BUILDKITE_BUILD_NUMBER:
BUILDKITE_BUILD_URL:
BUILDKITE_JOB_ID:
BUILDKITE_LABEL:
BUILDKITE_MESSAGE:
BUILDKITE_PIPELINE_NAME:
Expand Down
4 changes: 2 additions & 2 deletions examples/sdk-app-example/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ android {
}

dependencies {
implementation "com.bugsnag:bugsnag-android:5.31.2"
implementation "com.bugsnag:bugsnag-plugin-android-okhttp:5.31.2"
implementation "com.bugsnag:bugsnag-android:5.31.3"
implementation "com.bugsnag:bugsnag-plugin-android-okhttp:5.31.3"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "androidx.appcompat:appcompat:1.4.0"
implementation "com.google.android.material:material:1.4.0"
Expand Down
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.31.2
VERSION_NAME=5.31.3
GROUP=com.bugsnag
POM_SCM_URL=https://github.com/bugsnag/bugsnag-android
POM_SCM_CONNECTION=scm:[email protected]:bugsnag/bugsnag-android.git
Expand Down

0 comments on commit 0f2075b

Please sign in to comment.