logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 9cc46c55382d2e8960016b52f72ad63b0e55dd16
parent d4b889783c9ab8e73ba02b9c3bf1e36350de7b3c
Author: feld <feld@feld.me>
Date:   Sat, 13 Jan 2024 04:35:32 +0000

Merge branch 'qtfaststart-fix' into 'develop'

Fix MediaProxy crashing on some videos

See merge request pleroma/pleroma!4024

Diffstat:

Achangelog.d/qtfaststart.fix1+
Mlib/pleroma/helpers/qt_fast_start.ex25+++++++++++++++----------
2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/changelog.d/qtfaststart.fix b/changelog.d/qtfaststart.fix @@ -0,0 +1 @@ +MediaProxy Preview failures prevented when encountering certain video files diff --git a/lib/pleroma/helpers/qt_fast_start.ex b/lib/pleroma/helpers/qt_fast_start.ex @@ -40,16 +40,21 @@ defmodule Pleroma.Helpers.QtFastStart do got_mdat, acc ) do - full_size = (size - 8) * 8 - <<data::bits-size(full_size), rest::bits>> = rest - - acc = [ - {fourcc, pos, pos + size, size, - <<size::integer-big-size(32), fourcc::bits-size(32), data::bits>>} - | acc - ] - - fix(rest, pos + size, got_moov || fourcc == "moov", got_mdat || fourcc == "mdat", acc) + try do + full_size = (size - 8) * 8 + <<data::bits-size(full_size), rest::bits>> = rest + + acc = [ + {fourcc, pos, pos + size, size, + <<size::integer-big-size(32), fourcc::bits-size(32), data::bits>>} + | acc + ] + + fix(rest, pos + size, got_moov || fourcc == "moov", got_mdat || fourcc == "mdat", acc) + rescue + _ -> + :abort + end end defp fix(<<>>, _pos, _, _, acc) do