ggml-org/whisper.cpp

Lack of escaping in wts output

Open

#339 ouverte le 27 déc. 2022

Voir sur GitHub
 (0 commentaires) (0 réactions) (0 assignés)C++ (5 535 forks)batch import
enhancementgood first issue

Métriques du dépôt

Stars
 (49 693 stars)
Métriques de merge PR
 (Merge moyen 5j 20h) (36 PRs mergées en 30 j)

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.

Guide contributeur