mirror of
https://github.com/D-Modem/bbs.git
synced 2026-11-28 17:38:04 -08:00
A board takes files besides images when its file types say so (bbs chan board set DIR files webm,mp4,pdf; sound yes), as 4chan's take WebM and /po/ PDFs. Each file is known by its bytes and read before it is kept: - WebM: its EBML walked for the doc type (webm, not any Matroska), the tracks' codecs (VP8, VP9, AV1; Vorbis, Opus), size and length - MP4: its boxes walked for the movie header and tracks (H.264, AV1, VP9; AAC, Opus); HEVC and the like refused, as browsers do not all play them - PDF: whole (%PDF- to %%EOF), its pages counted and first page's size found where its objects are not compressed Videos are at most 4096 pixels a side and [chan] max_video seconds long (120; one that does not say is refused while there is a limit), and silent unless the board takes sound. Thumbnails come from [chan] ffmpeg (the first frame, the container named to it) and pdftoppm (the first page), else a card saying what the file is. In the page a video's thumbnail plays it in place with [Close]; a PDF's opens it in a tab, served without the boards' CSP (a viewer will not run under it) and nosniff. The post form lists what the board takes; posts say a video's length, a PDF's pages; the JSON has 4chan's webm_audio and max_webm_duration, and duration_ms, page_count, file_types. Terminals show their thumbnails. Fuzzing the readers found an EBML element head read past its parent (a panic); fixed, the input kept as a regression case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
4.0 KiB
4.0 KiB