diff options
author | Jack Palevich <jackpal@google.com> | 2012-09-23 15:07:31 -0700 |
---|---|---|
committer | Jack Palevich <jackpal@google.com> | 2012-09-23 15:07:31 -0700 |
commit | d12fb93f703c989a44bd3965e3aee2195f50ad5a (patch) | |
tree | ec3b6d170bfc5526ca120a2c5bed8a9a3aa3d8d4 | |
parent | 1b2d8fb47173cb3ef88754ad2ff843957c35db17 (diff) | |
download | AndroidTerm-d12fb93f703c989a44bd3965e3aee2195f50ad5a.tar.gz |
Add repro case for issue 145
(Which is an exception thrown while drawing UTF8 text)
-rw-r--r-- | tests/fuzzer/README.md | 27 | ||||
-rw-r--r-- | tests/fuzzer/fuzz.txt | 2 | ||||
-rw-r--r-- | tests/fuzzer/fuzzer.go | 37 |
3 files changed, 66 insertions, 0 deletions
diff --git a/tests/fuzzer/README.md b/tests/fuzzer/README.md new file mode 100644 index 0000000..e01467d --- /dev/null +++ b/tests/fuzzer/README.md @@ -0,0 +1,27 @@ +This directory contains files to help reproduce issue 145 + +fuzzer.go generates random strings of UTF-encoded characters. + +issue145repro.txt - some text from a run of fuzzer.go. + +Created by ./fuzzer | head -c 983 | tail -c 6 >issue145repro.txt + +This is a minimal repro case for + +https://github.com/jackpal/Android-Terminal-Emulator/issues/145 + +Repro steps +----------- + +On a PC: + +adb shell mkdir /data/local +adb push issue145repro.txt /data/local/issue145repro.txt + +Run ATE + +Configure ATE's preferences for UTF8 + +On ATE: + +cat /data/local/issue145repro.txt diff --git a/tests/fuzzer/fuzz.txt b/tests/fuzzer/fuzz.txt new file mode 100644 index 0000000..d5ed584 --- /dev/null +++ b/tests/fuzzer/fuzz.txt @@ -0,0 +1,2 @@ +𬘴 +(
\ No newline at end of file diff --git a/tests/fuzzer/fuzzer.go b/tests/fuzzer/fuzzer.go new file mode 100644 index 0000000..250a42e --- /dev/null +++ b/tests/fuzzer/fuzzer.go @@ -0,0 +1,37 @@ +// Generate a repatable string of characters for fuzz testing. + +package main + +import ( + "fmt" + "math/rand" + "unicode" +) + +func main() { + source := rand.NewSource(17) + r := rand.New(source) + + for { + switch r.Intn(4) { + case 0: + if r.Intn(20) == 0 { + fmt.Printf("\n") + } else { + out(r, 32, 128) + } + case 1: + out(r, 128, 256) + case 2: + out(r, 256, 0x10000) + default: + out(r, 0x10000, unicode.MaxRune) + } + } +} + +func out(r *rand.Rand, begin, end int) { + var c rune + c = (rune)(r.Intn(end-begin) + begin) + fmt.Printf("%c", c) +} |