GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||
GeezerVison is showing github.com — Regression 4.2.8.Final - HttpUtil.isEncodingSafeStartLineToken incorrectly rejects valid URI characters 'J' and 'M' due to bit-shift modulo behavior · Issue #16034 · netty/netty Closed as duplicate DescriptionSummaryThe security fix in commit 2f2e437 introduced a bug where valid ASCII characters 'J' (uppercase), 'M' (uppercase), and '`' (backtick) are incorrectly rejected as "illegal characters" in HTTP request URIs. Environment
Expected BehaviorValid URIs containing uppercase 'J' or 'M' characters should be accepted. For example: Actual BehaviorURIs containing 'J' or 'M' are rejected with: Root CauseThe issue is in private static final long ILLEGAL_REQUEST_LINE_TOKEN_OCTET_MASK = 1L << '\n' | 1L << '\r' | 1L << ' '; The check uses: long ch = 1L << token.charAt(i); if ((ch & ILLEGAL_REQUEST_LINE_TOKEN_OCTET_MASK) != 0) { return false; } The problem: Java's
Reproductionimport io.netty.handler.codec.http.HttpUtil; public class Test { public static void main(String[] args) { // This should return true but returns false in 4.2.8.Final System.out.println(HttpUtil.isEncodingSafeStartLineToken("/path?id=JKL")); // false (wrong!) System.out.println(HttpUtil.isEncodingSafeStartLineToken("/path?id=MNO")); // false (wrong!) System.out.println(HttpUtil.isEncodingSafeStartLineToken("/path?id=ABC")); // true (correct) } } ImpactThis breaks any HTTP client using Netty 4.2.8.Final that sends requests with URIs containing 'J' or 'M' characters. Suggested FixReplace the bit-shift approach with direct character comparison: public static boolean isEncodingSafeStartLineToken(CharSequence token) { for (int i = 0; i < token.length(); i++) { char c = token.charAt(i); if (c == '\n' || c == '\r' || c == ' ') { return false; } } return true; } ActivityMetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions | ||||||||||||||||||||||||||||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |