ggml-org/whisper.cpp

Lack of escaping in wts output

Open

#339 opened on Dec 27, 2022

View on GitHub
 (0 comments) (0 reactions) (0 assignees)C++ (5,535 forks)batch import
enhancementgood first issue

Repository metrics

Stars
 (49,693 stars)
PR merge metrics
 (Avg merge 5d 20h) (36 merged PRs in 30d)

Description

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.

Contributor guide