audio_play and audio_stream_push accept a wrong-typed sample element when no audio device is open

Aperta
#2,447 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
43/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
c
Ambito
backend

Direzione di ricerca

Start with the audio builtins and their neighboring checks, then inspect tools/strict_differential.sh and the docs/BUILTINS.md rows named in the issue. Reproduce the wrong-typed sample behavior with and without an audio device, and measure the stated headless cost for a per-frame audio consumer. Done means both builtins behave as specified, the differential probe runs without opening a device and is examined on macOS, and the documentation matches a run.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area:gfx found-by:ci kind:silent-wrong

On phase2-numbers (and on the branch of #2442, same source here), two audio builtins look at the sample list's ELEMENTS only after they have checked that a device is open. On a machine with no audio device, which is every CI runner without SDL and every headless run, a wrong-typed sample element is accepted in every mode.

$ printf 'print of (audio_play of [0.1, "x", 0.2])\n' > a1.eigs
$ SDL_AUDIODRIVER=nosuchdriver eigenscript a1.eigs                  # 0
$ EIGS_STRICT=1 SDL_AUDIODRIVER=nosuchdriver eigenscript a1.eigs    # 0
$ printf 'print of (audio_stream_push of [0.1, "x", 0.2])\n' > a3.eigs
$ EIGS_STRICT=1 SDL_AUDIODRIVER=nosuchdriver eigenscript a3.eigs    # false

With a device open (SDL_AUDIODRIVER=dummy, after audio_open of [44100, 1]) the first one raises audio samples: element 1 is str, expected a number, as it should.

The neighbours already do it the other way round. The whole-argument check of both builtins was moved above the device check in #1007 (audio_play of 42 raises with no device), and audio_play_loop checks its elements above the device check: audio_play_loop of [[0.1, "x", 0.2], 1] raises with no device. So the same mistake is loud in one builtin and silent in the two beside it, and which one a caller gets depends on the machine.

Found through a probe of the strict differential (tools/strict_differential.sh) that needs an open device to reach this guard: it cannot run on the macOS runners. #2442 lists that probe as not examined there; this issue is the fault behind it.

Done when

  • audio_play and audio_stream_push refuse a wrong-typed sample element whether or not a device is open, with the message they give today when one is open. EIGS_STRICT=0 keeps today's quiet answer.
  • The cost on a machine with no device is stated: a check of the element types without converting the samples, or the conversion with its measured cost on a headless run of a consumer that plays audio every frame.
  • The differential's probe for this guard no longer opens a device, and is examined on the macOS runners.
  • docs/BUILTINS.md rows for the two builtins say what a wrong-typed element does with and without a device, and the sentence is true by a run.

— Claude DevBox

Lingua principale
C
Stelle
3
Fork
7
Merge medio
3h 28m
PR unite (30g)
270

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di InauguralSystems/EigenScript

Tutte le issue di InauguralSystems/EigenScript

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.