Skip to content

Commit

Permalink
Merge branch 'CCExtractor:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
prateekmedia authored Jan 10, 2024
2 parents 2c5a894 + 63a259a commit 39b4f5d
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 27 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
steps:
- name: Install dependencies
run: sudo apt update && sudo apt-get install libgpac-dev libtesseract-dev
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: build
run: ./build
working-directory: ./linux
Expand All @@ -38,7 +38,7 @@ jobs:
run: mkdir ./linux/artifacts
- name: Copy release artifact
run: cp ./linux/ccextractor ./linux/artifacts/
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: CCExtractor Linux build
path: ./linux/artifacts
Expand All @@ -47,7 +47,7 @@ jobs:
steps:
- name: Install dependencies
run: sudo apt update && sudo apt-get install libgpac-dev
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: run autogen
run: ./autogen.sh
working-directory: ./linux
Expand All @@ -65,7 +65,7 @@ jobs:
steps:
- name: Install dependencies
run: sudo apt update && sudo apt-get install libgpac-dev
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: cmake
run: mkdir build && cd build && cmake ../src
- name: build
Expand All @@ -76,7 +76,7 @@ jobs:
cmake_ocr_hardsubx:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt update && sudo apt install libgpac-dev libtesseract-dev libavformat-dev libavdevice-dev libswscale-dev yasm
- name: cmake
Expand All @@ -94,7 +94,7 @@ jobs:
steps:
- name: Install dependencies
run: sudo apt update && sudo apt-get install libgpac-dev
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: cache
uses: actions/cache@v3
with:
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/build_mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
steps:
- name: Install dependencies
run: brew install pkg-config autoconf automake libtool tesseract leptonica gpac
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: build
run: ./build.command
working-directory: ./mac
Expand All @@ -38,14 +38,14 @@ jobs:
run: mkdir ./mac/artifacts
- name: Copy release artifact
run: cp ./mac/ccextractor ./mac/artifacts/
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: CCExtractor mac build
path: ./mac/artifacts
build_autoconf:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install dependencies
run: brew install pkg-config autoconf automake libtool gpac
- name: run autogen
Expand All @@ -63,10 +63,10 @@ jobs:
cmake:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: dependencies
run: brew install gpac
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: cmake
run: mkdir build && cd build && cmake ../src
- name: build
Expand All @@ -77,7 +77,7 @@ jobs:
cmake_ocr_hardsubx:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install dependencies
run: brew install pkg-config autoconf automake libtool tesseract leptonica gpac ffmpeg
- name: cmake
Expand All @@ -93,7 +93,7 @@ jobs:
build_rust:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: cache
uses: actions/cache@v3
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
runs-on: windows-2019
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup MSBuild.exe
uses: microsoft/[email protected]
- name: Install llvm and clang
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
- name: Display version information
run: ./ccextractorwinfull.exe --version
working-directory: ./windows/x64/Release-Full
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: CCExtractor Windows Release build
path: |
Expand All @@ -67,7 +67,7 @@ jobs:
runs-on: windows-2019
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup MSBuild.exe
uses: microsoft/[email protected]
- name: Install llvm and clang
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
- name: Display version information
run: ./ccextractorwinfull.exe --version
working-directory: ./windows/x64/Debug-Full
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: CCExtractor Windows Debug build
path: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Format code
run: |
find src/ -type f -not -path "src/thirdparty/*" -not -path "src/lib_ccx/zvbi/*" -name '*.c' -not -path "src/GUI/icon_data.c" | xargs clang-format -i
Expand All @@ -30,7 +30,7 @@ jobs:
run:
working-directory: ./src/rust
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: cache
uses: actions/cache@v3
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: windows-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
Expand Down Expand Up @@ -62,20 +62,20 @@ jobs:
run: wix build -ext "$HOME\.wix\extensions\WixToolset.UI.wixext\4.0.0-preview.0\tools\WixToolset.UI.wixext.dll" -d "AppVersion=${{ steps.get_version.outputs.VERSION }}.0.0" -o CCExtractor.msi installer.wxs
working-directory: ./windows
- name: Upload as asset
uses: AButler/upload-release-assets@v2.0
uses: AButler/upload-release-assets@v3.0
with:
files: './windows/CCExtractor.msi;./windows/CCExtractor_win_portable.zip'
repo-token: ${{ secrets.GITHUB_TOKEN }}
create_linux_package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: ./ccextractor
- name: Create .tar.gz without git and windows folders
run: tar -pczf ./ccextractor_minimal.tar.gz --exclude "ccextractor/windows" --exclude "ccextractor/.git" ccextractor
- name: Upload as asset
uses: AButler/upload-release-assets@v2.0
uses: AButler/upload-release-assets@v3.0
with:
files: './ccextractor_minimal.tar.gz'
repo-token: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions docs/CHANGES.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
- Fix: Repeated values for enums
- Cleanup: Remove the (unmaintained) Nuklear GUI code
- Cleanup: Reduce the amount of Windows build options in the project file
- Fix: infinite loop in MP4 file type detector.

0.94 (2021-12-14)
-----------------
Expand Down
4 changes: 3 additions & 1 deletion docs/COMPILATION.MD
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ git clone https://github.com/CCExtractor/ccextractor.git
Debian:

```bash
sudo apt-get install -y libglew-dev libglfw3-dev cmake gcc libcurl4-gnutls-dev tesseract-ocr libtesseract-dev libleptonica-dev clang libclang-dev
sudo apt-get install -y libgpac-dev libglew-dev libglfw3-dev cmake gcc libcurl4-gnutls-dev tesseract-ocr libtesseract-dev libleptonica-dev clang libclang-dev
```

RHEL:
Expand All @@ -33,6 +33,8 @@ sudo paru -S glew glfw curl tesseract leptonica cmake gcc clang

Rust 1.54 or above is also required. [Install Rust](https://www.rust-lang.org/tools/install). Check specific compilation methods below, on how to compile without rust.

**Note:** On Ubuntu Version 23.10 (Mantic) and later, `libgpac-dev` isn't available, you should build gpac from source by following the easy build instructions [here](https://github.com/gpac/gpac/wiki/GPAC-Build-Guide-for-Linux)

**Note:** On Ubuntu Version 18.04 (Bionic) and later, `libtesseract-dev` is installed rather than `tesseract-ocr-dev`, which does not exist anymore.

**Note:** On Ubuntu Version 14.04 (Trusty) and earlier, you should build leptonica and tesseract from source
Expand Down
27 changes: 25 additions & 2 deletions src/lib_ccx/mp4.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ static int process_avc_sample(struct lib_ccx_ctx *ctx, u32 timescale, GF_AVCConf
{
u32 nal_length;

if (i + c->nal_unit_size > s->dataLength)
{
mprint("Corrupted packet detected in process_avc_sample. dataLength "
"%u is less than index %u + nal_unit_size %u. Ignoring.\n",
s->dataLength, i, c->nal_unit_size);
// The packet is likely corrupted, it's unsafe to read this many bytes
// even to detect the length of the next `nal`. Ignoring this error,
// hopefully the outer loop in `process_avc_track` can recover.
return status;
}
switch (c->nal_unit_size)
{
case 1:
Expand All @@ -63,15 +73,28 @@ static int process_avc_sample(struct lib_ccx_ctx *ctx, u32 timescale, GF_AVCConf
nal_length = bswap32(*(long *)&s->data[i]);
break;
}
const u32 previous_index = i;
i += c->nal_unit_size;
if (i + nal_length <= previous_index || i + nal_length > s->dataLength)
{
mprint("Corrupted sample detected in process_avc_sample. dataLength %u "
"is less than index %u + nal_unit_size %u + nal_length %u. Ignoring.\n",
s->dataLength, previous_index, c->nal_unit_size, nal_length);
// The packet is likely corrupted, it's unsafe to procell nal_length bytes
// because they are past the sample end. Ignoring this error, hopefully
// the outer loop in `process_avc_track` can recover.
return status;
}

s_nalu_stats.total += 1;
s_nalu_stats.type[s->data[i] & 0x1F] += 1;

temp_debug = 0;

if (nal_length > 0)
{
// s->data[i] is only relevant and safe to access here.
s_nalu_stats.type[s->data[i] & 0x1F] += 1;
do_NAL(enc_ctx, dec_ctx, (unsigned char *)&(s->data[i]), nal_length, sub);
}
i += nal_length;
} // outer for
assert(i == s->dataLength);
Expand Down
2 changes: 1 addition & 1 deletion src/lib_ccx/stream_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void detect_stream_type(struct ccx_demuxer *ctx)
while (idx < ctx->startbytes_avail - 8)
{
// Check if we have a valid box
if (isValidMP4Box(ctx->startbytes, idx, &nextBoxLocation, &boxScore))
if (isValidMP4Box(ctx->startbytes, idx, &nextBoxLocation, &boxScore) && nextBoxLocation > idx)
{
idx = nextBoxLocation; // If the box is valid, a new box should be found on the next location... Not somewhere in between.
if (boxScore > 7)
Expand Down

0 comments on commit 39b4f5d

Please sign in to comment.