Commit Graph
1914 Commits
Author SHA1 Message Date
Valdis Vitolins 2e41cdde38 Merge pull request #1212 2022-06-27 14:43:50 +03:00
Samuel Thibault dfc322743d MAKE_MEM_UNDEFINED: Fix warning 2022-06-12 00:26:17 +02:00
Samuel Thibault f4133364d1 Add more const qualifiers 2022-06-11 16:20:19 +02:00
Samuel Thibault 6f58f75693 Add missing phoneme table reset
When there are language switches, when we rewind to the start of the
phoneme list we have to reset the phoneme table back.

This avoids some branching that depends on undefined values, caught by
valgrind in the case e.g. of an emoji substitution that contains a
language switch.

Ref #874
2022-06-09 13:20:43 +02:00
Samuel Thibault 3b009398c9 Add missing stresslevel field initialization 2022-06-09 12:21:05 +02:00
Samuel Thibault eed7db1575 Fix out-of-bound access
IsLetterGroup looks for heading \0, so the padding also needs to include
an \0.
2022-06-09 11:26:17 +02:00
Samuel Thibault 24e1eaa0cc Mark static arrays undefined when they are reused
So valgrind can potentially catch e.g. missing \0.
2022-06-09 09:48:43 +02:00
Samuel Thibault 7e608a3273 Make some buffers non-static
These don't actually need to survive function exit.
2022-06-09 09:46:19 +02:00
Samuel Thibault a660fc04cc Add more const qualifiers on static arrays
So we know they are just tables, get protected from overflows, and get shared between processes
2022-06-09 08:43:50 +02:00
Samuel Thibault 2d3a49b161 Make static arrays undefined on entry into LoadVoice
This would have caught #1200
2022-06-09 08:37:56 +02:00
Samuel Thibault afdf50bfd3 Add a note to avoid erroneous commits like e91d0a5
Fixes #1200
2022-06-09 08:12:45 +02:00
Sean Budd 139417e8e1 Revert "code cleanup: don't add a \0 to voices_language in LoadVoice()."
This reverts commit e91d0a5861.
2022-06-09 11:23:48 +10:00
Valdis Vitolins abd8ff5f71 Merge pull request #1158 2022-04-14 17:30:08 +03:00
Valdis Vitolins 77cc6c1a9c Merge pull request #1157 2022-04-14 17:29:55 +03:00
Valdis Vitolins bff48e078e Merge pull request #1156 2022-04-14 17:29:43 +03:00
Samuel Thibault 5087b05c52 Mark re-used "source" array as undefined
And fix the prefetches after \0.
2022-04-13 23:24:30 +02:00
Samuel Thibault 1228094127 Mark re-used phoneme_tab array as undefined
And make sure that the unfilled entries are NULL to catch any spurious
reference.

Also fix some missing phoneme table switch according to language
changes.
2022-04-13 23:24:13 +02:00
Samuel Thibault 199cbe4a1a Mark re-used phoneme_list as undefined
And fill the last phlist prepause and newword fields, otherwise they are
detected as undefined:

==483407== Conditional jump or move depends on uninitialised value(s)
==483407==    at 0x488E6AB: Generate (synthesize.c:1228)
==483407==    by 0x488FD94: SpeakNextClause (synthesize.c:1587)
==483407==    by 0x4887F56: Synthesize (speech.c:457)
==483407==    by 0x488884C: sync_espeak_Synth (speech.c:570)
==483407==    by 0x487B270: espeak_Synth (espeak_api.c:90)
==483407==    by 0x10ACA0: main (espeak-ng.c:691)
==483407==  Uninitialised value was created by a client request
==483407==    at 0x4884893: MakePhonemeList (phonemelist.c:155)
==483407==    by 0x4895712: TranslateClause (translate.c:2682)
==483407==    by 0x488FCCF: SpeakNextClause (synthesize.c:1569)
==483407==    by 0x4887F56: Synthesize (speech.c:457)
==483407==    by 0x488884C: sync_espeak_Synth (speech.c:570)
==483407==    by 0x487B270: espeak_Synth (espeak_api.c:90)
==483407==    by 0x10ACA0: main (espeak-ng.c:691)
==483407==
==483407== Conditional jump or move depends on uninitialised value(s)
==483407==    at 0x488E622: Generate (synthesize.c:1211)
==483407==    by 0x488FD94: SpeakNextClause (synthesize.c:1587)
==483407==    by 0x4887F56: Synthesize (speech.c:457)
==483407==    by 0x488884C: sync_espeak_Synth (speech.c:570)
==483407==    by 0x487B270: espeak_Synth (espeak_api.c:90)
==483407==    by 0x10ACA0: main (espeak-ng.c:691)
==483407==  Uninitialised value was created by a client request
==483407==    at 0x4884893: MakePhonemeList (phonemelist.c:155)
==483407==    by 0x4895712: TranslateClause (translate.c:2682)
==483407==    by 0x488FCCF: SpeakNextClause (synthesize.c:1569)
==483407==    by 0x4887F56: Synthesize (speech.c:457)
==483407==    by 0x488884C: sync_espeak_Synth (speech.c:570)
==483407==    by 0x487B270: espeak_Synth (espeak_api.c:90)
==483407==    by 0x10ACA0: main (espeak-ng.c:691)
==483407==

This is changing the ssml.test output, but with no audible difference,
so this is probably a real fix for it.
2022-04-13 23:24:04 +02:00
Samuel Thibault f1ce2ec423 Mark re-used ph_list2 array as undefined
And fix looking after end of array.
2022-04-13 23:23:51 +02:00
Valdis Vitolins f56c7ea185 Merge pull request #1154 2022-04-13 22:43:06 +03:00
Samuel Thibault 15804e57a2 Constify tables
So they are protected from overflows, and shared between processes
2022-04-10 22:48:40 +02:00
Samuel Thibault 3ce135ac2b Mark re-used buffers as undefined
These are global arrays reused several times. When using them msan and
valgrind thus believe they are always initialized, which reduces their
capacity to detect uninitialized values. We can however explicitly tell them
when they are reused, and thus to be considered as uninitialized.
2022-04-10 22:42:51 +02:00
Samuel Thibault a34d74ed43 Make envelope computation more robust
When pollint() returns 100.0, multiplying by 2.55 doesn't actually seem to
be getting 255 on i386. Multiplying by 255 and dividing by 100, however,
does (probably because float computation with small integer values are
guaranteed to have integer results).

Fixes #1151
2022-04-10 22:12:28 +02:00
Samuel Thibault 310e8fc768 Avoid using floating-point operation
This has varying behavior depending on toolchain and processor.

Fixes #1151
2022-04-10 20:48:43 +02:00
Samuel Thibault e8253c6513 ssml: Use a larger buffer
When building espeak-ng in a directory that has a long path, 80 bytes to
store it is quite short.
2022-04-10 16:16:00 +02:00
Samuel Thibault 90c035c406 Fix overflow while capping to signed 16bit 2022-04-08 01:59:31 +02:00
Samuel Thibault c91aa78363 LoadSoundFile: Fix char signedness 2022-04-08 01:24:50 +02:00
Samuel Thibault 2c524ec8df Fix loading wav files on big-endian architectures
Fixes #1152
2022-04-08 01:18:16 +02:00
Valdis Vitolins 22fb690bf8 Merge pull request #1149 2022-04-02 23:14:16 +03:00
Valdis Vitolins 9fc8aa4a54 eSpeak NG 1.52-dev 2022-04-02 22:35:41 +03:00
Valdis Vitolins 2e9a5fccbb Release 1.51 2022-04-02 22:24:41 +03:00
Samuel Thibault fc05678e41 CheckThousandsGroup: Fix checking heading character before thousand group 2022-04-02 21:13:55 +02:00
Valdis Vitolins 6fd31db229 Merge pull request #1148 2022-04-02 22:05:13 +03:00
Alexander Epaneshnikov 4b7b4866af windows: add installation directory to path
fixes #700
2022-04-02 00:28:22 +03:00
Alexander Epaneshnikov 8fe65b5820 windows: install all data files
this fixes #891
2022-04-02 00:27:59 +03:00
Alexander Epaneshnikov d54a02c5d9 windows: include new sourcecode files
ref: https://github.com/espeak-ng/espeak-ng/issues/857#issuecomment-962500311
2022-04-01 23:38:46 +03:00
Alexander Epaneshnikov a525531d98 windows: build all dictionaries 2022-04-01 23:38:45 +03:00
Alexander Epaneshnikov 72d1bae4b6 windows: retarget solutions to latest sdk and PlatformToolset 2022-04-01 23:38:44 +03:00
Alexander Epaneshnikov 4ca505d01e windows: don't include winsock2.h
otherwise we get many errors
2022-04-01 23:38:34 +03:00
Samuel Thibault f352f1e43f CheckThousandsGroup: Avoid reading uninitialized data
For the case when word is smaller than 4 characters, we should not look at
the 3rd or 4th character before checking the previous ones, otherwise
we'd at best read uninitialized data, at worse non-existing data.
2022-04-01 20:18:00 +02:00
Samuel Thibault ee0a468f95 soundicon: Avoid calling remove with uninitialized name
fname_temp is not always getting filled.
2022-03-28 01:03:31 +02:00
Samuel Thibault fe63f1b3e7 MatchRule: Do not overflow the text
Some rules test against character not being of a certain type. That may
match with the \0 end-of-text marker, and thus actually step over
it and let MatchRule continue with uninitialized data after it, leading
to potential random behavior.

This commits fixes it by making sure that we don't read past that \0.

This seems to be changing the pronunciation of "capitals" from k'apIt@Lz to
k'apIt,alz, I don't know why, I guess the rule for it was actually
bogus?
2022-03-25 22:49:41 +02:00
Valdis Vitolins 5b67176356 Merge pull request #1130 2022-03-23 19:37:15 +02:00
Samuel Thibault 55b2e9b2a3 MatchRule: Prevent non-eating special characters from eating characters
Special characters such as N, S1, etc. are not actually eating
characters. Their treatment should thus *not* update pre_ptr and post_ptr,
otherwise those would underflow/overflow, e.g. in the case

@) s (_NS1  [z]

this would overflow. This for instance noticeable with the memory sanitizer:

ESPEAK_DATA_PATH=$PWD ./src/espeak-ng -qX "capitals"
Translate 'capitals'
  1	c        [k]

  1	a        [a]

  1	p        [p]

  1	i        [I]

  1	t        [t]

  1	a        [a]

  1	l        [l]
 20	l (C     [l]

==2837201==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7f7f4422744b in utf8_in2 /home/samy/brl/speech/espeak-ng-git/src/libespeak-ng/translate.c:281:2
    #1 0x7f7f442281bc in utf8_in /home/samy/brl/speech/espeak-ng-git/src/libespeak-ng/translate.c:332:9
    #2 0x7f7f440e0d31 in MatchRule /home/samy/brl/speech/espeak-ng-git/src/libespeak-ng/dictionary.c:1767:21
    #3 0x7f7f440d937f in TranslateRules /home/samy/brl/speech/espeak-ng-git/src/libespeak-ng/dictionary.c:2320:6
    #4 0x7f7f44230e5f in TranslateWord3 /home/samy/brl/speech/espeak-ng-git/src/libespeak-ng/translate.c:733:15
    #5 0x7f7f44229844 in TranslateWord /home/samy/brl/speech/espeak-ng-git/src/libespeak-ng/translate.c:1100:14
    #6 0x7f7f44256e50 in TranslateWord2 /home/samy/brl/speech/espeak-ng-git/src/libespeak-ng/translate.c:1361:11
    #7 0x7f7f4424d6cc in TranslateClause /home/samy/brl/speech/espeak-ng-git/src/libespeak-ng/translate.c:2623:17
    #8 0x7f7f44213359 in SpeakNextClause /home/samy/brl/speech/espeak-ng-git/src/libespeak-ng/synthesize.c:1569:2
    #9 0x7f7f441a9f56 in Synthesize /home/samy/brl/speech/espeak-ng-git/src/libespeak-ng/speech.c:457:2
    #10 0x7f7f441a9023 in sync_espeak_Synth /home/samy/brl/speech/espeak-ng-git/src/libespeak-ng/speech.c:570:29
    #11 0x7f7f441ad59f in espeak_ng_Synthesize /home/samy/brl/speech/espeak-ng-git/src/libespeak-ng/speech.c:678:10
    #12 0x7f7f4410b3f4 in espeak_Synth /home/samy/brl/speech/espeak-ng-git/src/libespeak-ng/espeak_api.c:90:32
    #13 0x4a8be3 in main /home/samy/brl/speech/espeak-ng-git/src/espeak-ng.c:691:3
    #14 0x7f7f43a2e7fc in __libc_start_main csu/../csu/libc-start.c:332:16
    #15 0x421449 in _start (/home/samy/ens/projet/1/speech/espeak-ng-git/src/.libs/espeak-ng+0x421449)

  Uninitialized value was created by an allocation of 'sbuf' in the stack frame of function 'TranslateClause'
    #0 0x7f7f4423a1f0 in TranslateClause /home/samy/brl/speech/espeak-ng-git/src/libespeak-ng/translate.c:1941

While trying to match _NS1, MatchRule is overflowing the buffer.

It happens that this had not usually posed problem because rules usually
have these non-eating special characters last in the rule and thus it wasn't
mattering that post_ptr is pointing outside valid text.
2022-03-20 21:51:05 +01:00
Samuel Thibault caf8e650c2 MatchRule: Support multibyte doubled letters
When matching a double-letter whose encoding needs multiple bytes, to
properly skip the double-letter we have to skip these bytes, like other
rules.
2022-03-20 21:50:43 +01:00
Valdis Vitolins 1e310d95a3 Merge pull request #1125 2022-03-20 22:21:15 +02:00
Valdis Vitolins 07ec8170d1 Merge pull request #1124 2022-03-20 22:20:53 +02:00
Valdis Vitolins 370b47846b Merge pull request #1123 2022-03-20 22:20:29 +02:00
Valdis Vitolins 4f9ec83598 Merge pull request #1122 2022-03-20 22:20:02 +02:00
Valdis Vitolins 3572290fbf Merge pull request #1121 2022-03-20 22:19:45 +02:00