Better HN
topnewbestaskshowjobs
Log inSign up

knight666

62 karma · joined Jun 20, 2012 (14y ago) · 17 submissions

Submissions

1.

Utf8rewind 1.5.0 improves case mapping performance by 15% across the board(bitbucket.org ↗)

2 points · by knight666 · 10y ago · discuss

2.

Windows 10 Broke My Unit Test(knight666.com ↗)

5 points · by knight666 · 10y ago · discuss

3.

Utf8rewind 1.4.0 – Adds support for case folding and matching by category(bitbucket.org ↗)

2 points · by knight666 · 10y ago · discuss

4.

Utf8rewind's case mapping is 75% faster and now supports Turkish(bitbucket.org ↗)

2 points · by knight666 · 10y ago · discuss

5.

Utf8rewind 1.3.0 adds Turkish case mapping and improves performance by 75%(bitbucket.org ↗)

3 points · by knight666 · 10y ago · discuss

6.

Utf8rewind 1.3.0 – 75% faster and now supports Turkish, Lithuanian and Greek(bitbucket.org ↗)

2 points · by knight666 · 10y ago · discuss

7.

The Curious Case of the Greek Final Sigma(knight666.com ↗)

26 points · by knight666 · 11y ago · 5 comments

comment 11y ago · link · parent

This is actually guarded against in a macro:

    #define UTF8_VALIDATE_PARAMETERS(_inputType, _outputType, _result) \
        if (input == 0) { \
            UTF8_SET_ERROR(INVALID_DATA); \
            return _result; \
        } \
If a NUL parameter is passed to utf8toutf16 and friends, they'll return UTF8_ERR_INVALID_DATA.

However, you are correct about codepoint_read's behavior. I actually have a test for passing NUL to the function, but the value of decoded isn't checked:

    TEST(CodepointRead, InvalidData)
    {
        const char* i = nullptr;
        size_t il = 0;
        unicode_t o;

        EXPECT_EQ(0, codepoint_read(i, il, &o));
    }
It's definitely a bug, but relatively harmless. The function is only used internally and the calling sites guard against that kind of attack.

Nevertheless, I thank you for the extra set of eyeballs. I have been looking at these functions far too long, you tend to gloss over obvious problems after a while.

I'll be sure to get a fix in for the next release. :)

comment 11y ago · link · parent

You can find all case folding codepoints on the Unicode Consortium website: ftp://ftp.unicode.org/Public/UNIDATA/CaseFolding.txt and ftp://ftp.unicode.org/Public/UNIDATA/SpecialCasing.txt.

As you get down the list you'll notice what a pain in the ass the special cases are. There's a special case for the final sigma in a Greek word:

    03A3; 03C2; 03A3; 03A3; Final_Sigma; # GREEK CAPITAL LETTER SIGMA
You must remove the dot from "i" when upper or titlecasing... but only in Lithuanian:

    0307; 0307; ; ; lt After_Soft_Dotted; # COMBINING DOT ABOVE
Etc. etc. By the way, my implementation for case mapping started out similarly to yours, but I ultimately solved the problem using a binary search in a huge look-up table: https://bitbucket.org/knight666/utf8rewind/src/c22e458912952...

Unicode case mapping is just a huge mess of exceptions, but that's more the humans' fault than the standard.

comment 11y ago · link · parent

It wasn't before, but I looked up how to host static HTML on Bitbucket. You can now read the documentation online here:

http://knight666.bitbucket.org/utf8rewind/

comment 11y ago · link · parent

No, currently Turkish, Greek, Lithuanian and Azeri case mappings are not always grammatically correct. This is because utf8rewind currently does not take the system locale into account when case mapping. Fixing these issues is planned for a future release.

comment 11y ago · link · parent

Author here.

The library currently doesn't employ any kind of fuzzing. I rely on multiple tests for every kind of input. I've found that is a pretty reliable way to test for "unknown unknowns", even if it's extremely time-consuming.

Adding testcase fuzzing is definitely something to consider though, because it would most likely have found the very issues this release fixes.

comment 11y ago · link · parent

You've probably never heard of it because it has 136 downloads in total. ;)

It's very thoroughly tested but it hasn't been used in any serious projects yet.

14.

Utf8rewind changes for 1.2.1(bitbucket.org ↗)

40 points · by knight666 · 11y ago · 21 comments

15.

Utf8rewind 1.2.0 – Adds support for Unicode 7.0 case mapping and normalization(bitbucket.org ↗)

2 points · by knight666 · 11y ago · discuss

16.

Critical security update for utf8rewind(bitbucket.org ↗)

1 points · by knight666 · 12y ago · discuss

17.

How to flip input handling on its head with action mapping(knight666.com ↗)

1 points · by knight666 · 13y ago · discuss