ggml-org/whisper.cpp

Lack of escaping in wts output

Open

#339 aperta il 27 dic 2022

Vedi su GitHub
 (0 commenti) (0 reazioni) (0 assegnatari)C++ (5535 fork)batch import
enhancementgood first issue

Metriche repository

Star
 (49.693 star)
Metriche merge PR
 (Merge medio 5g 20h) (36 PR mergiate in 30 g)

Descrizione

I noticed a few escaping issues:

  1. The input name is just piped raw into the output.

https://github.com/ggerganov/whisper.cpp/blob/ac521a566ea6a79ba968c30101140db9f65d187b/examples/main/main.cpp#L342

  1. Likewise for the output file.

https://github.com/ggerganov/whisper.cpp/blob/ac521a566ea6a79ba968c30101140db9f65d187b/examples/main/main.cpp#L425

The font, by contrast, is wrapped in quotes.

https://github.com/ggerganov/whisper.cpp/blob/ac521a566ea6a79ba968c30101140db9f65d187b/examples/main/main.cpp#L360

I'm unfamiliar with handling user input in c++; I'd expect that fonts are ok to quote like this, but filenames should have some proper escaping (not least because user input is being piped directly into a shell script, that users are encouraged to source, never mind run).


As an aside, would it be possible to add \-escaped newlines to the generated text, too?


I don't anticipate using wts, myself, so I might not be the best person to check whether any changes are appropriate.

Great tool, btw.

Guida contributor