Overview
| Artifact ID: | 60427d4d45bc919752ff993eb484c69da31a16ee435a26c66f62d5ad29484049 |
|---|---|
| Ticket: | bd94500678e837d7ed50cf6d5000df8f38cd5e39
SEGFAULT by conversion of unicode (out of BMP) to byte-array. |
| User & Date: | sebres on 2019-02-18 21:35:50 |
Changes
- icomment:
Thx, Jan! +1 for the proposed logic; I should still take a closer look considering all possible corner cases (but I assume it could be safe now). Just to avoid a certain continuous misprediction, I would change the order everywhere, because <code>(len == 1)</code> is mostly the case (so valid for 99% e.g. for each single byte ascii). So possibly something like: <code><pre> <b style="color:red">- if ((len == 1) && ((ch & 0xFC00) == 0xD800)) ...</b> <b style="color:green">+ if (((ch & 0xFC00) == 0xD800) && (len == 1)) ...</b> </pre></code> And would be this not enough as check? <code><pre> <b style="color:red">- if ((len == 1) && ((ch & 0xFC00) == 0xD800)) ...</b> <b style="color:green">+ if ((ch >= 0xD800) && (len == 1)) ...</b> </pre></code> I think either it is 0xD800 + [0..0x3ff] or len > 1. Am I wrong?
- login: "sebres"
- mimetype: "text/x-fossil-wiki"