Gitweb links:
...log
http://git.netsurf-browser.org/libnsgif.git/shortlog/fa1f47e6bec71ed970a0...
...commit
http://git.netsurf-browser.org/libnsgif.git/commit/fa1f47e6bec71ed970a02a...
...tree
http://git.netsurf-browser.org/libnsgif.git/tree/fa1f47e6bec71ed970a02a51...
The branch, master has been updated
via fa1f47e6bec71ed970a02a517056fac677256c9d (commit)
via 0d66555889b14d23b75c43757d910ccdb5e1cead (commit)
via 4494ff22208bef17066c3df8a2359cdcb6b90290 (commit)
from 77cd05347ced58d7116be72148bff8e28d3ee1b9 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/libnsgif.git/commit/?id=fa1f47e6bec71ed970...
commit fa1f47e6bec71ed970a02a517056fac677256c9d
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <mdrake.unique(a)gmail.com>
GitHub CI: Add static analysis with CodeQL
diff --git a/.github/workflows/static-analysis.yaml
b/.github/workflows/static-analysis.yaml
new file mode 100644
index 0000000..ec5171f
--- /dev/null
+++ b/.github/workflows/static-analysis.yaml
@@ -0,0 +1,61 @@
+name: "Static Analysis"
+
+on: [push]
+
+jobs:
+ codeql:
+ name: codeql
+ runs-on: ubuntu-22.04
+
+ strategy:
+ fail-fast: false
+ matrix:
+ language: ['cpp']
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v2
+ with:
+ fetch-depth: 1
+
+ - name: apt-get install packages
+ run: sudo apt-get update -qq &&
+ sudo apt-get install --no-install-recommends -y
+ bison
+ build-essential
+ check
+ clang
+ flex
+ git
+ gperf
+ llvm
+ pkg-config
+
+ - name: Get env.sh
+ run: |
+ mkdir projects
+ wget -O projects/env.sh
https://git.netsurf-browser.org/netsurf.git/plain/docs/env.sh
+
+ - name: Build and install project deps
+ env:
+ TARGET: ${{ github.event.repository.name }}
+ run: |
+ export TARGET_WORKSPACE="$(pwd)/projects"
+ source projects/env.sh
+ ns-clone -d -s
+ ns-make-libs install
+
+ # Initializes the CodeQL tools for scanning.
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@v2
+ with:
+ languages: ${{ matrix.language }}
+
+ - name: Build Library
+ run: |
+ export TARGET_WORKSPACE="$(pwd)/projects"
+ source projects/env.sh
+ make -j"$(nproc)"
+
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze@v2
commitdiff
http://git.netsurf-browser.org/libnsgif.git/commit/?id=0d66555889b14d23b7...
commit 0d66555889b14d23b75c43757d910ccdb5e1cead
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <mdrake.unique(a)gmail.com>
GitHub CI: Add build and unit test workflow
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
new file mode 100644
index 0000000..629c048
--- /dev/null
+++ b/.github/workflows/build.yaml
@@ -0,0 +1,76 @@
+name: "Linux Build"
+
+on: [push]
+
+jobs:
+ linux:
+ name: '${{ matrix.os }}: ${{ matrix.compiler.vendor }}'
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ os:
+ - ubuntu-22.04
+ - ubuntu-20.04
+ compiler:
+ # The NetSurf build system can't find LLVM AR (it looks for it
+ # in /usr/lib instead of /usr/bin:
+ # `make: /usr/lib/llvm-ar: No such file or directory`).
+ # So we need to make it explicit for llvm.
+ - { vendor: gnu, CC: gcc, AR: ar }
+ - { vendor: llvm, CC: clang, AR: llvm-ar }
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 1
+
+ - name: apt-get install packages
+ run: sudo apt-get update -qq &&
+ sudo apt-get install --no-install-recommends -y
+ bison
+ build-essential
+ check
+ clang
+ flex
+ git
+ gperf
+ llvm
+ pkg-config
+
+ - name: Get env.sh
+ run: |
+ mkdir projects
+ wget -O projects/env.sh
https://git.netsurf-browser.org/netsurf.git/plain/docs/env.sh
+
+ - name: Build and install project deps
+ env:
+ CC: ${{ matrix.compiler.CC }}
+ AR: ${{ matrix.compiler.AR }}
+ TARGET: ${{ github.event.repository.name }}
+ run: |
+ export TARGET_WORKSPACE="$(pwd)/projects"
+ source projects/env.sh
+ ns-clone -d -s
+ ns-make-libs install
+
+ - name: Build Library
+ env:
+ CC: ${{ matrix.compiler.CC }}
+ AR: ${{ matrix.compiler.AR }}
+ TARGET: ${{ github.event.repository.name }}
+ run: |
+ export TARGET_WORKSPACE="$(pwd)/projects"
+ source projects/env.sh
+ make -j"$(nproc)"
+
+ - name: Unit Tests
+ env:
+ CC: ${{ matrix.compiler.CC }}
+ AR: ${{ matrix.compiler.AR }}
+ TARGET: ${{ github.event.repository.name }}
+ run: |
+ export TARGET_WORKSPACE="$(pwd)/projects"
+ source projects/env.sh
+ make test
commitdiff
http://git.netsurf-browser.org/libnsgif.git/commit/?id=4494ff22208bef1706...
commit 4494ff22208bef17066c3df8a2359cdcb6b90290
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <mdrake.unique(a)gmail.com>
GIF: Squash multiplication result converted to larger type
diff --git a/src/gif.c b/src/gif.c
index 8655bdb..fb4b03e 100644
--- a/src/gif.c
+++ b/src/gif.c
@@ -295,6 +295,9 @@ static void nsgif__record_frame(
struct nsgif *gif,
const uint32_t *bitmap)
{
+ size_t pixel_bytes = sizeof(*bitmap);
+ size_t height = gif->info.height;
+ size_t width = gif->info.width;
uint32_t *prev_frame;
if (gif->decoded_frame == NSGIF_FRAME_INVALID ||
@@ -310,7 +313,7 @@ static void nsgif__record_frame(
if (gif->prev_frame == NULL) {
prev_frame = realloc(gif->prev_frame,
- gif->info.width * gif->info.height * 4);
+ width * height * pixel_bytes);
if (prev_frame == NULL) {
return;
}
@@ -318,7 +321,7 @@ static void nsgif__record_frame(
prev_frame = gif->prev_frame;
}
- memcpy(prev_frame, bitmap, gif->info.width * gif->info.height * 4);
+ memcpy(prev_frame, bitmap, width * height * pixel_bytes);
gif->prev_frame = prev_frame;
gif->prev_index = gif->decoded_frame;
@@ -329,10 +332,11 @@ static nsgif_error nsgif__recover_frame(
uint32_t *bitmap)
{
const uint32_t *prev_frame = gif->prev_frame;
- unsigned height = gif->info.height;
- unsigned width = gif->info.width;
+ size_t pixel_bytes = sizeof(*bitmap);
+ size_t height = gif->info.height;
+ size_t width = gif->info.width;
- memcpy(bitmap, prev_frame, height * width * sizeof(*bitmap));
+ memcpy(bitmap, prev_frame, height * width * pixel_bytes);
return NSGIF_OK;
}
@@ -642,9 +646,14 @@ static void nsgif__restore_bg(
struct nsgif_frame *frame,
uint32_t *bitmap)
{
+ size_t pixel_bytes = sizeof(*bitmap);
+
if (frame == NULL) {
+ size_t width = gif->info.width;
+ size_t height = gif->info.height;
+
memset(bitmap, NSGIF_TRANSPARENT_COLOUR,
- gif->info.width * gif->info.height * sizeof(*bitmap));
+ width * height * pixel_bytes);
} else {
uint32_t width = frame->info.rect.x1 - frame->info.rect.x0;
uint32_t height = frame->info.rect.y1 - frame->info.rect.y0;
@@ -665,7 +674,7 @@ static void nsgif__restore_bg(
uint32_t *scanline = bitmap + offset_x +
(offset_y + y) * gif->info.width;
memset(scanline, NSGIF_TRANSPARENT_COLOUR,
- width * sizeof(*bitmap));
+ width * pixel_bytes);
}
} else {
for (uint32_t y = 0; y < height; y++) {
-----------------------------------------------------------------------
Summary of changes:
.github/workflows/build.yaml | 76 ++++++++++++++++++++++++++++++++
.github/workflows/static-analysis.yaml | 61 +++++++++++++++++++++++++
src/gif.c | 23 +++++++---
3 files changed, 153 insertions(+), 7 deletions(-)
create mode 100644 .github/workflows/build.yaml
create mode 100644 .github/workflows/static-analysis.yaml
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
new file mode 100644
index 0000000..629c048
--- /dev/null
+++ b/.github/workflows/build.yaml
@@ -0,0 +1,76 @@
+name: "Linux Build"
+
+on: [push]
+
+jobs:
+ linux:
+ name: '${{ matrix.os }}: ${{ matrix.compiler.vendor }}'
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ os:
+ - ubuntu-22.04
+ - ubuntu-20.04
+ compiler:
+ # The NetSurf build system can't find LLVM AR (it looks for it
+ # in /usr/lib instead of /usr/bin:
+ # `make: /usr/lib/llvm-ar: No such file or directory`).
+ # So we need to make it explicit for llvm.
+ - { vendor: gnu, CC: gcc, AR: ar }
+ - { vendor: llvm, CC: clang, AR: llvm-ar }
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 1
+
+ - name: apt-get install packages
+ run: sudo apt-get update -qq &&
+ sudo apt-get install --no-install-recommends -y
+ bison
+ build-essential
+ check
+ clang
+ flex
+ git
+ gperf
+ llvm
+ pkg-config
+
+ - name: Get env.sh
+ run: |
+ mkdir projects
+ wget -O projects/env.sh
https://git.netsurf-browser.org/netsurf.git/plain/docs/env.sh
+
+ - name: Build and install project deps
+ env:
+ CC: ${{ matrix.compiler.CC }}
+ AR: ${{ matrix.compiler.AR }}
+ TARGET: ${{ github.event.repository.name }}
+ run: |
+ export TARGET_WORKSPACE="$(pwd)/projects"
+ source projects/env.sh
+ ns-clone -d -s
+ ns-make-libs install
+
+ - name: Build Library
+ env:
+ CC: ${{ matrix.compiler.CC }}
+ AR: ${{ matrix.compiler.AR }}
+ TARGET: ${{ github.event.repository.name }}
+ run: |
+ export TARGET_WORKSPACE="$(pwd)/projects"
+ source projects/env.sh
+ make -j"$(nproc)"
+
+ - name: Unit Tests
+ env:
+ CC: ${{ matrix.compiler.CC }}
+ AR: ${{ matrix.compiler.AR }}
+ TARGET: ${{ github.event.repository.name }}
+ run: |
+ export TARGET_WORKSPACE="$(pwd)/projects"
+ source projects/env.sh
+ make test
diff --git a/.github/workflows/static-analysis.yaml
b/.github/workflows/static-analysis.yaml
new file mode 100644
index 0000000..ec5171f
--- /dev/null
+++ b/.github/workflows/static-analysis.yaml
@@ -0,0 +1,61 @@
+name: "Static Analysis"
+
+on: [push]
+
+jobs:
+ codeql:
+ name: codeql
+ runs-on: ubuntu-22.04
+
+ strategy:
+ fail-fast: false
+ matrix:
+ language: ['cpp']
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v2
+ with:
+ fetch-depth: 1
+
+ - name: apt-get install packages
+ run: sudo apt-get update -qq &&
+ sudo apt-get install --no-install-recommends -y
+ bison
+ build-essential
+ check
+ clang
+ flex
+ git
+ gperf
+ llvm
+ pkg-config
+
+ - name: Get env.sh
+ run: |
+ mkdir projects
+ wget -O projects/env.sh
https://git.netsurf-browser.org/netsurf.git/plain/docs/env.sh
+
+ - name: Build and install project deps
+ env:
+ TARGET: ${{ github.event.repository.name }}
+ run: |
+ export TARGET_WORKSPACE="$(pwd)/projects"
+ source projects/env.sh
+ ns-clone -d -s
+ ns-make-libs install
+
+ # Initializes the CodeQL tools for scanning.
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@v2
+ with:
+ languages: ${{ matrix.language }}
+
+ - name: Build Library
+ run: |
+ export TARGET_WORKSPACE="$(pwd)/projects"
+ source projects/env.sh
+ make -j"$(nproc)"
+
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze@v2
diff --git a/src/gif.c b/src/gif.c
index 8655bdb..fb4b03e 100644
--- a/src/gif.c
+++ b/src/gif.c
@@ -295,6 +295,9 @@ static void nsgif__record_frame(
struct nsgif *gif,
const uint32_t *bitmap)
{
+ size_t pixel_bytes = sizeof(*bitmap);
+ size_t height = gif->info.height;
+ size_t width = gif->info.width;
uint32_t *prev_frame;
if (gif->decoded_frame == NSGIF_FRAME_INVALID ||
@@ -310,7 +313,7 @@ static void nsgif__record_frame(
if (gif->prev_frame == NULL) {
prev_frame = realloc(gif->prev_frame,
- gif->info.width * gif->info.height * 4);
+ width * height * pixel_bytes);
if (prev_frame == NULL) {
return;
}
@@ -318,7 +321,7 @@ static void nsgif__record_frame(
prev_frame = gif->prev_frame;
}
- memcpy(prev_frame, bitmap, gif->info.width * gif->info.height * 4);
+ memcpy(prev_frame, bitmap, width * height * pixel_bytes);
gif->prev_frame = prev_frame;
gif->prev_index = gif->decoded_frame;
@@ -329,10 +332,11 @@ static nsgif_error nsgif__recover_frame(
uint32_t *bitmap)
{
const uint32_t *prev_frame = gif->prev_frame;
- unsigned height = gif->info.height;
- unsigned width = gif->info.width;
+ size_t pixel_bytes = sizeof(*bitmap);
+ size_t height = gif->info.height;
+ size_t width = gif->info.width;
- memcpy(bitmap, prev_frame, height * width * sizeof(*bitmap));
+ memcpy(bitmap, prev_frame, height * width * pixel_bytes);
return NSGIF_OK;
}
@@ -642,9 +646,14 @@ static void nsgif__restore_bg(
struct nsgif_frame *frame,
uint32_t *bitmap)
{
+ size_t pixel_bytes = sizeof(*bitmap);
+
if (frame == NULL) {
+ size_t width = gif->info.width;
+ size_t height = gif->info.height;
+
memset(bitmap, NSGIF_TRANSPARENT_COLOUR,
- gif->info.width * gif->info.height * sizeof(*bitmap));
+ width * height * pixel_bytes);
} else {
uint32_t width = frame->info.rect.x1 - frame->info.rect.x0;
uint32_t height = frame->info.rect.y1 - frame->info.rect.y0;
@@ -665,7 +674,7 @@ static void nsgif__restore_bg(
uint32_t *scanline = bitmap + offset_x +
(offset_y + y) * gif->info.width;
memset(scanline, NSGIF_TRANSPARENT_COLOUR,
- width * sizeof(*bitmap));
+ width * pixel_bytes);
}
} else {
for (uint32_t y = 0; y < height; y++) {
--
NetSurf GIF Decoder