Commit Graph
1575 Commits
Author SHA1 Message Date
Reece H. Dunn 2d7f3e9d54 Don't skip blanks past charix_top in TranslateClause. 2018-03-22 20:49:15 +00:00
Reece H. Dunn 7dad0dfd40 Prevent TranslateRoman reading stack data from Lookup. 2018-03-22 20:12:35 +00:00
Reece H. Dunn b24db06a84 Copy name to tr->dictionary_name if not equal
This is a similar change to b60d2452c3.
In this case, it is when tr->dictionary_name is passed as the name
parameter in LoadDictionary.

This happens in the SetTranslator2 function when loading the
dictionary for the second language translator object.
2018-03-22 19:48:56 +00:00
Reece H. Dunn bb19c7a336 Release the memory allocated by p_text in espeak-ng.c. 2018-03-22 19:37:25 +00:00
Reece H. Dunn 062cb8dfc9 Merge remote-tracking branch 'valdisvi/master' 2018-03-22 19:09:29 +00:00
Reece H. Dunn 879cb9c08a Don't free 'tr' if null in DeleteTranslator. 2018-03-22 19:01:59 +00:00
Valdis Vitolins ad1fa7f25f Expose SpectSeqCreate(), SpectSeqDestroy() and LoadSpectSeq() functions for eSpeakNG Java Editor 2018-03-22 10:25:13 +02:00
Reece H. Dunn d23735ae1b Release the translator memory in espeak{_ng,}_Terminate. 2018-03-22 07:26:22 +00:00
Reece H. Dunn 87a2586bb0 Fix formatting of free_rules. 2018-03-22 07:19:26 +00:00
Reece H. Dunn 444e4544d2 Simplify the !v comparison and check PATHSEP
SetVoiceStack looks for "!v" in variant_name and skips the first
three characters if "!v" is found. The problem here is that it
does not check that the third character is the path separator, so
may advance into unknown memory if variant_name is exactly "!v".

This fixes that problem by checking for the path separator. It
also simplifies the logic by checking the bytes explicitly.

NOTE: This is not strictly needed, as the only code paths this is
relevant for is in espeak_ng_SetVoiceByName, and the variant name
comes from ExtractVoiceVariantName, which sets up the variant name
correctly.
2018-03-21 21:35:26 +00:00
Reece H. Dunn c9ca77a4d4 Compare variant_name with "!v" only if long enough
Various places call SetVoiceStack with "" for the variant_name. This
causes -fsanitize=address to fail with an overflow as the call to
memcmp is checking the first 2 bytes, and there is only 1 byte
available.
2018-03-21 21:16:08 +00:00
Reece H. Dunn a08d2c7bfb Ensure the allocated rules are properly cleaned up in compile_dictrules. 2018-03-21 20:58:55 +00:00
Reece H. Dunn b60d2452c3 Copy name in LoadDictionary if not dictionary_name
compiledict.c sets dict_name to dictionary_name if dict_name is
not set, and passes that to LoadDictionary. LoadDictionary then
copies the passed in name to dictionary_name.

This causes -fsanitize=address to fail with overlapping memory
addresses passed to strncpy (copying the string to itself). As
such, don't copy the name in this case.
2018-03-21 20:37:44 +00:00
Sascha Brawer 8aa4521d31 Make phoneme properties unsigned
Fixes two sanitizer warnings:

```
src/libespeak-ng/compiledata.c:2291:27: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
src/libespeak-ng/compiledata.c:2424:34: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
```
2018-03-20 02:29:32 +01:00
Reece H. Dunn 7429a58510 Merge commit '22009de5f84974e77147fd5264781fb1c09a7764' 2018-03-19 20:51:53 +00:00
Reece H. Dunn 22009de5f8 Fix running the tests with -fsanitize=address. 2018-03-19 20:22:54 +00:00
Reece H. Dunn 768957e0fc Don't copy filepath to buf. [coverity]
No modification was being done to buf after the copy of filepath.
It was just being passed to fopen. As such the copy is redundant,
and can lead to buffer overflow issues if the specified filepath
is larger than buf.
2018-03-17 07:13:21 +00:00
Reece H. Dunn d0410d8585 Include dictionary.h in the relevant source files to avoid implicit-function-declaration warnings. 2018-03-17 07:12:45 +00:00
Reece H. Dunn 99bbc6294e Fix building on Windows. 2018-03-12 12:26:57 +00:00
Reece H. Dunn 07e155a150 TranslateWord2: Don't process invalid phonemes.
If ph_code is not located in the phoneme_tab, the resulting ph
value will be NULL. This does not normally happen, but it can
happen if word_phonemes contains garbage data, such as with the
1.49.2 multi-word logic when processing words like 'riposted'.
2018-03-11 18:00:38 +00:00
Reece H. Dunn eaa08a2bc3 translate: Don't crash translating root words that map to another list entry.
If the list file contains a text replacement to another
entry in the list file, e.g.:

	ripost     riposte $text
	riposte    rI#p0st

calling it from a prefix or suffix rule such as 'riposted'
causes word_out[0] to be NULL, as TranslateWord3 has the
information needed to perform the mapping. In this case,
no phonemes have been written in this loop and the phonemes
have been calculated, so don't override them.
2018-03-11 17:58:15 +00:00
Reece H. Dunn 05e571ca4a compiledict.h: espeak_ng_CompileDictionary is defined in espeak_ng.h, so don't redefine it here. 2018-03-11 14:26:19 +00:00
Juho Hiltunen 29cba35a9e headers: add new file mbrola.h with declarations of functions in compilembrola.c and synth_mbrola.c 2018-03-11 11:44:48 +02:00
Juho Hiltunen f00ff91fe4 headers: add new file wavegen.h with declarations of functions in wavegen.c 2018-03-11 11:27:56 +02:00
Juho Hiltunen 9012f3f0bf headers: continue with synthdata.h 2018-03-10 13:54:58 +02:00
Juho Hiltunen e04ae259e0 headers: add new file compiledict.h with declarations of functions in compiledict.c 2018-03-10 12:51:24 +02:00
Juho Hiltunen 655dbf6b7a remove unnecessary include of synthesize.h 2018-03-10 12:47:08 +02:00
Juho Hiltunen 231a1d0944 headers: add new file dictionary.h with declarations of functions in dictionary.c 2018-03-10 12:47:02 +02:00
Juho Hiltunen cd991bd2c9 headers: add new file numbers.h with declarations of functions in numbers.c 2018-03-10 09:27:23 +02:00
Juho Hiltunen 07160f9286 headers: add new file synthdata.h with declarations of functions in synthdata.c 2018-03-10 08:23:24 +02:00
Juho Hiltunen d395efa481 headers: add new file phonemelist.h with declarations of functions in phonemelist.c 2018-03-10 08:02:24 +02:00
Juho Hiltunen 098904dfe0 headers: add new file setlengths.h with declarations of functions in setlengths.c 2018-03-10 08:02:17 +02:00
Juho Hiltunen 9d12d23d2a headers: add new file intonation.h with declarations of functions in intonation.c 2018-03-10 07:49:04 +02:00
Juho Hiltunen 706df97b20 headers: add new file readclause.h with declarations of functions in readclause.c 2018-03-10 07:18:07 +02:00
Juho Hiltunen 079d5a92c5 remove more unnecessary speech.h includes 2018-03-09 21:08:38 +02:00
Juho Hiltunen 30ad5c39f6 move struct MatchRecord to dictionary.c since it's the only file that uses it 2018-03-09 21:08:38 +02:00
Juho Hiltunen 342f077755 remove unused declarations of ChangePhonemes_ru() and struct CHANGEPH
these are the only references in the code.
2018-03-09 21:08:38 +02:00
Juho Hiltunen d1fd650219 Replace references to USHORT, DOUBLEX and UCHAR with unsigned short, double and unsigned char.
This makes the codebase more consistent. Including speech.h is not necessary anymore in some files. Includes have been removed.
2018-03-09 21:08:38 +02:00
Juho Hiltunen 738492100a make all headers (almost) self-contained by using include guards and #include statements within headers 2018-03-09 21:08:15 +02:00
Reece H. Dunn c5f88c51dd translate.c: Don't loop to the end of sbuf, as sbuf gets null terminated, so needs a byte for the null character. [msvc /analyze]. 2018-03-07 12:56:26 +00:00
Reece H. Dunn c49164334b Ensure each name in proc_names can fit an item_string [msvc /analyze]. 2018-03-07 12:50:58 +00:00
Reece H. Dunn 583a23f0cd Use ENV_LEN in the fwrite call in LoadEnvelope2 to be consistent with the rest of the function. 2018-03-07 12:36:58 +00:00
Reece H. Dunn 19e425a169 windows: add ssml.c to the project to fix building on Windows 2018-03-07 12:27:39 +00:00
Reece H. Dunn b23f475e1a ssml.h: Reformat the header file. 2018-03-04 09:32:29 +00:00
Reece H. Dunn d47e48a377 ssml: Update the copyright notice. 2018-03-04 09:27:52 +00:00
Reece H. Dunn 017c6a9383 ssml.h: Add a copyright header and include guards. 2018-03-04 09:25:06 +00:00
Reece H. Dunn 49b97105e5 ssml: Move ssmltags to ssml.c where it is used.
This avoids 'unused parameter' errors in readclause.c.
2018-03-04 09:18:34 +00:00
Juho Hiltunen 985e7d5b39 set functions in ssml.c static.
The only entry point in the file is ProcessSsmlTags().
2018-03-03 23:46:58 +02:00
Juho Hiltunen ace9bc087a fix syntax for pointer incrementation
previous syntax was a quick fix when changing from globals to pointers.
2018-03-03 23:45:42 +02:00
Juho Hiltunen a47ff4f41d move ProcessSsmlTag() from readclause.to to ssml.c
use parameters instead of globals
2018-03-03 23:45:03 +02:00