Skip to content
Open
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
114 changes: 114 additions & 0 deletions .github/workflows/native_full_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: BT-Core Coverity Incremental Analysis Scan

Comment on lines +1 to +2
Comment on lines +1 to +2
Comment on lines +1 to +2
on:
Comment on lines +1 to +3
Comment on lines +1 to +3
Comment on lines +1 to +3
pull_request:
branches: [ develop ]
push:
branches: [ develop ]

jobs:
native-build:
runs-on: ubuntu-latest
Comment on lines +1 to +11
Comment on lines +1 to +11

Comment on lines +1 to +12
Comment on lines +1 to +12
steps:
# ----------------------------------------
# Checkout
# ----------------------------------------
- name: Checkout Bluetooth source
uses: actions/checkout@v4

# ----------------------------------------
# System dependencies
# ----------------------------------------
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
autoconf automake libtool pkg-config \
gcc g++ make \
libglib2.0-dev libdbus-1-dev libbluetooth-dev

# ----------------------------------------
# Telemetry stub (NO external repos)
# ----------------------------------------
- name: Build telemetry stub library
run: |
git clone https://github.com/rdkcentral/telemetry.git
Comment on lines +32 to +36

Comment on lines +31 to +37
mkdir -p ${GITHUB_WORKSPACE}/external/include

cp telemetry/include/telemetry_busmessage_sender.h \
${GITHUB_WORKSPACE}/external/include/

cp telemetry/include/telemetry2_0.h \
${GITHUB_WORKSPACE}/external/include/
Comment on lines +36 to +44

mkdir -p ${GITHUB_WORKSPACE}/external/lib

cat << 'EOF' > telemetry_stub.c
Comment on lines +32 to +48
int t2_init(void) { return 0; }
int t2_event_s(const char* n, const char* v) { return 0; }
int t2_event_f(const char* n, float v) { return 0; }
int t2_event_d(const char* n, double v) { return 0; }
EOF

gcc -shared -fPIC telemetry_stub.c \
Comment on lines +49 to +55
Comment on lines +48 to +55
-o ${GITHUB_WORKSPACE}/external/lib/libtelemetry_msgsender.so

# ----------------------------------------
# Legacy BlueZ audio headers (for avMedia)
# ----------------------------------------
- name: Install BlueZ audio headers
run: |
git clone https://github.com/bluez/bluez.git
git -C bluez checkout tags/4.101

mkdir -p ${GITHUB_WORKSPACE}/external/include/bluetooth/audio
mkdir -p ${GITHUB_WORKSPACE}/external/include/bluetooth

cp bluez/audio/ipc.h \
${GITHUB_WORKSPACE}/external/include/bluetooth/audio/ipc.h

git -C bluez checkout tags/5.48

cp bluez/profiles/audio/a2dp-codecs.h \
${GITHUB_WORKSPACE}/external/include/bluetooth/audio/a2dp-codecs.h
cp bluez/lib/bluetooth.h \
${GITHUB_WORKSPACE}/external/include/bluetooth/bluetooth.h

# Required by modern GCC
sed -i '1i#include <stdbool.h>\n' \
${GITHUB_WORKSPACE}/external/include/bluetooth/audio/ipc.h

Comment on lines +63 to +82
# ----------------------------------------
# Autotools bootstrap
# ----------------------------------------
- name: Bootstrap autotools
run: |
libtoolize --force
aclocal
autoheader
automake --force-missing --add-missing
autoconf

# ----------------------------------------
# Configure Bluetooth
# ----------------------------------------
- name: Configure Bluetooth
run: |
CPPFLAGS="-I${GITHUB_WORKSPACE}/external/include" \
LDFLAGS="-L${GITHUB_WORKSPACE}/external/lib" \
CFLAGS="-Wno-error" \
CXXFLAGS="-Wno-error" \
ac_cv_header_telemetry_busmessage_sender_h=yes \
./configure
env:
LD_LIBRARY_PATH: ${{ github.workspace }}/external/lib

Comment on lines +101 to +107
# ----------------------------------------
# Build production libraries (explicit order)
# ----------------------------------------
- name: Build Bluetooth libraries
run: |
make -C src/bt-ifce -j$(nproc)
make -C src -j$(nproc)
2 changes: 1 addition & 1 deletion src/btrCore.c
Original file line number Diff line number Diff line change
Expand Up @@ -7258,7 +7258,7 @@ btrCore_BTAdapterStatusUpdateCb (
return -1;
}

memset(&lstAdapterInfo, 0, sizeof(stBTRCoreAdapter));
memset(&lstAdapterInfo, 0, 10*sizeof(stBTRCoreAdapter));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity Issue - Wrong sizeof argument

Passing argument "&lstAdapterInfo" of type "stBTRCoreAdapter *" and argument "480UL" ("10UL * 48UL") to function "memset" is suspicious because "sizeof (stBTRCoreAdapter) /48/" is expected.

Medium Impact, CWE-131
SIZEOF_MISMATCH

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity Issue - Out-of-bounds access

Overrunning struct type stBTRCoreAdapter of 48 bytes by passing it to a function which accesses it at byte offset 479 using argument "480UL".

High Impact, CWE-119
OVERRUN

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity Issue - Wrong sizeof argument

Passing argument "&lstAdapterInfo" of type "stBTRCoreAdapter *" and argument "480UL" ("10UL * 48UL") to function "memset" is suspicious because "sizeof (stBTRCoreAdapter) /48/" is expected.

Medium Impact, CWE-131
SIZEOF_MISMATCH

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity Issue - Out-of-bounds access

Overrunning struct type stBTRCoreAdapter of 48 bytes by passing it to a function which accesses it at byte offset 479 using argument "480UL".

High Impact, CWE-119
OVERRUN

lstAdapterInfo.adapter_number = atoi(apstBTAdapterInfo->pcPath + pathlen-1);

BTRCORELOG_INFO ("adapter number = %d, path = %s, discovering = %d\n",
Expand Down
Loading