]> sourceware.org Git - systemtap.git/commit
runtime: reject overlong UTF-8, output as raw octal instead
authorJosh Stone <jistone@redhat.com>
Wed, 28 Oct 2015 00:42:32 +0000 (17:42 -0700)
committerJosh Stone <jistone@redhat.com>
Wed, 28 Oct 2015 00:42:32 +0000 (17:42 -0700)
commit13879e3ea7422a7041a265397818e43e3b919373
tree0a44107c9007aa6298f132ab2b2aeee4ebde179d
parentd501b220fa55a446a3e5577ad7fc42bc9701ab91
runtime: reject overlong UTF-8, output as raw octal instead

Since string_quoted is meant to unambiguously represent its output, it's a
bad idea to let different UTF-8 byte sequences lead to the same Unicode
code point.  This can only happen if you allow 0-padded UTF-8 that ends up
longer than necessary.  It's especially bad if you let long zero encodings
like 0xC0 0x80 be treated as a string terminator!

If any UTF-8 was decoded from more bytes than its value should have needed,
just write it verbatim with octal escapes instead.
runtime/stp_string.c
testsuite/systemtap.base/utf_overlong.exp [new file with mode: 0644]
testsuite/systemtap.base/utf_overlong.stp [new file with mode: 0644]
This page took 0.025701 seconds and 5 git commands to generate.