Gitweb links:

...log 
http://git.netsurf-browser.org/libnsgif.git/shortlog/2139533bc7975f85c61a4405e9181fefb65fe7b8
...commit 
http://git.netsurf-browser.org/libnsgif.git/commit/2139533bc7975f85c61a4405e9181fefb65fe7b8
...tree 
http://git.netsurf-browser.org/libnsgif.git/tree/2139533bc7975f85c61a4405e9181fefb65fe7b8

The branch, tlsa/add-ci has been created
        at  2139533bc7975f85c61a4405e9181fefb65fe7b8 (commit)

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/libnsgif.git/commit/?id=2139533bc7975f85c61a4405e9181fefb65fe7b8
commit 2139533bc7975f85c61a4405e9181fefb65fe7b8
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>

    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=7b296f4fbff318daff1440bce7c459870e61fabc
commit 7b296f4fbff318daff1440bce7c459870e61fabc
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>

    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=88ae51f4e2a77bf98f42f51e8b4d8b80f16b03fb
commit 88ae51f4e2a77bf98f42f51e8b4d8b80f16b03fb
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>

    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++) {


-----------------------------------------------------------------------


-- 
NetSurf GIF Decoder
_______________________________________________
netsurf-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to