Opened 2 months ago

Closed 7 weeks ago

#32845 closed task (fixed)

Add UTF-8 validation unit tests

Reported by: teor Owned by: teor
Priority: Medium Milestone: Tor: 0.4.3.x-final
Component: Core Tor/Tor Version:
Severity: Normal Keywords: 043-should, utf-8, Unicode
Cc: Actual Points: 0.1
Parent ID: Points: 0.2
Reviewer: nickm Sponsor:

Description

We should add unit tests for the following UTF-8 sequences. Their validity varies between different programming languages. We should go with the common case (if it matches the standard).

Invalid:
surrogate nullsurrog threehigh
EDA081 3000EDA081 EDBFBF

fourhigh fivebyte sixbyte sixhigh
F490BFBF FB80808080 FD80808080 FDBFBFBFBF

Valid:
fourbyte fourbyte2
F0908D88 F0BFBFBF

Valid in the Unicode standard, invalid in torrcs and directory documents:
nullbyte
3031320033

See proposal 285 for details, and for the null byte exception:
https://gitweb.torproject.org/torspec.git/tree/proposals/285-utf-8.txt

Test Case Source:
POC||GTFO 19, page 43
https://www.alchemistowl.org/pocorgtfo/

Child Tickets

Change History (4)

comment:1 Changed 7 weeks ago by teor

Actual Points: 0.1

Please review and merge my PR:

I also added some additional error-checking for the string pointer and length.

comment:2 Changed 7 weeks ago by teor

Status: assignedneeds_review

comment:3 Changed 7 weeks ago by nickm

Reviewer: nickm

LGTM; squashed and merged.

comment:4 Changed 7 weeks ago by nickm

Resolution: fixed
Status: needs_reviewclosed

Whoops; should have closed when I merged.

Note: See TracTickets for help on using tickets.