gst-plugins-rs/video/cdg
Carlos Bentzen 72e641abab cdg: fix typefind error with specific file sizes
Currently, the typefind logic for cdg can cause errors on files
with all conditions below:
- size multiple of NB_WINDOWS * CDG_PACKET_SIZE (8 * 24) = 192
- size less than TYPEFIND_SEARCH_WINDOW (28800)
- extension different than .cdg

With those conditions, the cdg typefind function may be the last one to
execute and cause gsttypefindhelper.c::helper_find_peek to return
GST_FLOW_EOS, and if it's the final call will then be turned to
GST_FLOW_ERROR in typefind.

That is because cdg's typefind will perform a last call to
typefind.peek(len, CDG_PACKET_SIZE) which is outside the range of typefind
(from 0 to len - 1).

Reproducer with file from cdg tests:
```
head -n 28608 BrotherJohn.cdg > BrotherJohn_short.bit
gst-play-1.0 BrotherJohn_short.bit
```

Fix this by correcting the loop bounds in the cdg typefind
logic. Perhaps the typefind helper logic should be rewritten to avoid
such cases too.

Then the example above works and unrelated files aren't affected by this
in typefind anymore.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2059>
2025-02-05 01:05:11 +00:00
..
src cdg: fix typefind error with specific file sizes 2025-02-05 01:05:11 +00:00
tests Update to argumentless {Bin,Pipeline}::new 2023-05-12 12:55:31 +02:00
build.rs fix-getters-calls 0.3.0 pass 2021-04-20 18:19:58 +02:00
Cargo.toml cdg: update to image 0.25 2024-11-02 12:30:47 +02:00
LICENSE-APACHE git: replace LICENSE file symlinks with copies 2023-04-04 14:26:37 +01:00
LICENSE-MIT git: replace LICENSE file symlinks with copies 2023-04-04 14:26:37 +01:00