Package: release.debian.org
Severity: normal
Tags: bookworm
X-Debbugs-Cc: espeak...@packages.debian.org
Control: affects -1 + src:espeak-ng
User: release.debian....@packages.debian.org
Usertags: pu

Hello,

I have uploaded the attached changes to bookworm-proposed-updates.

[ Reason ]
This fixes an issue with the espeak-ng+mbrola speech synthesis.

[ Impact ]
Currently, when a user uses the espeak-ng+mbrola speech synthesis (which
is of way better quality than espeak-ng), all utterances see their last
letter dropped. For instance, if the screen reader tries to read
"Hello", it's actually "Hell" that is spoken.

More generally, anything given as stdin to espeak-ng gets its last byte
removed.

[ Tests ]
This was tested manually.

[ Risks ]
The code is very trivial.

[ Checklist ]
  [X] *all* changes are documented in the d/changelog
  [X] I reviewed all changes and I approve them
  [X] attach debdiff against the package in (old)stable
  [X] the issue is verified as fixed in unstable

[ Changes ]
Historically in espeak 1.48, the code reading stdin was putting all
characters being read into the p_text buffer, including the eventual
EOF. p_text[ix-1] was removing it by luck. With espeak-ng 1.49, that
spurious EOF addition was fixed, but p_text[ix-1] was still set to \0,
thus now actually removing the last byte of stdin. The changes shifts
adding \0 to after the last byte. The loop above was already making sure
that this is within p_text's allocation. This also fixes the string
length passed to the espeak_Synth function.
diff -Nru espeak-ng-1.51+dfsg/debian/changelog 
espeak-ng-1.51+dfsg/debian/changelog
--- espeak-ng-1.51+dfsg/debian/changelog        2023-12-21 01:26:02.000000000 
+0100
+++ espeak-ng-1.51+dfsg/debian/changelog        2024-12-21 00:17:25.000000000 
+0100
@@ -1,3 +1,9 @@
+espeak-ng (1.51+dfsg-10+deb12u2) bookworm; urgency=medium
+
+  * patches/espeak-stdin: Fix dropping last byte of stdin input.
+
+ -- Samuel Thibault <sthiba...@debian.org>  Sat, 21 Dec 2024 00:17:25 +0100
+
 espeak-ng (1.51+dfsg-10+deb12u1) bookworm; urgency=medium
 
   * patches/CVE: Fix CVE-2023-49990, CVE-2023-49991, CVE-2023-49992,
diff -Nru espeak-ng-1.51+dfsg/debian/patches/espeak-stdin 
espeak-ng-1.51+dfsg/debian/patches/espeak-stdin
--- espeak-ng-1.51+dfsg/debian/patches/espeak-stdin     1970-01-01 
01:00:00.000000000 +0100
+++ espeak-ng-1.51+dfsg/debian/patches/espeak-stdin     2024-12-21 
00:17:25.000000000 +0100
@@ -0,0 +1,28 @@
+commit 33b6daf420710eca2f6b2dcdc8eb3f6d72e1d313
+Author: Samuel Thibault <samuel.thiba...@ens-lyon.org>
+Date:   Sat Dec 21 00:07:12 2024 +0100
+
+    Fix dropping last byte of stdin input
+    
+    This got broken with eaa0c9aa08350ce8a1343aed4c0a87c1cc329b0e ("Fix
+    truncated fgetc return value in main(espeak-ng.c). [Coverity]") which
+    rightfully stopped adding a bogus EOF at the end of the input, which
+    this line was probably dropping just by luck.
+    
+    Fixes brailcom/speechd#978
+
+diff --git a/src/espeak-ng.c b/src/espeak-ng.c
+index ee63da70..2ea3791a 100644
+--- a/src/espeak-ng.c
++++ b/src/espeak-ng.c
+@@ -762,8 +762,8 @@ int main(int argc, char **argv)
+                               }
+                       }
+                       if (ix > 0) {
+-                              p_text[ix-1] = 0;
+-                              espeak_Synth(p_text, ix+1, 0, POS_CHARACTER, 0, 
synth_flags, NULL, NULL);
++                              p_text[ix] = 0;
++                              espeak_Synth(p_text, ix, 0, POS_CHARACTER, 0, 
synth_flags, NULL, NULL);
+                       }
+               }
+ 
diff -Nru espeak-ng-1.51+dfsg/debian/patches/series 
espeak-ng-1.51+dfsg/debian/patches/series
--- espeak-ng-1.51+dfsg/debian/patches/series   2023-12-21 01:26:02.000000000 
+0100
+++ espeak-ng-1.51+dfsg/debian/patches/series   2024-12-21 00:17:25.000000000 
+0100
@@ -10,3 +10,4 @@
 long-build-path
 mb-fr
 CVE
+espeak-stdin

Reply via email to