AOSP Source Releases Are So Late Developers Disassemble Libraries to Report Bugs
Recorded: Oct. 14, 2026, 7 a.m.
| Original | Summarized |
[BUG] bionic: wcscspn()/wcspbrk() treat every wchar_t >= 0x100 as a match (Android 17, CP3A.260905.009) · Issue #2260 · android/ndk · GitHub Skip to content Navigation MenuSign inAppearance settingsPlatformAI CODE CREATIONGitHub CopilotWrite better code with AIGitHub Copilot appDirect agents from issue to mergeMCP RegistryIntegrate external toolsDEVELOPER WORKFLOWSActionsAutomate any workflowCodespacesInstant dev environmentsIssuesPlan and track workCode ReviewManage code changesCode QualityEnforce quality at mergeAPPLICATION SECURITYGitHub Advanced SecurityFind and fix vulnerabilitiesCode securitySecure your code as you buildSecret protectionStop leaks before they startEXPLOREWhy GitHubDocumentationBlogChangelogMarketplaceView all featuresSolutionsBY COMPANY SIZEEnterprisesSmall and medium teamsStartupsNonprofitsBY USE CASEApp ModernizationDevSecOpsDevOpsCI/CDView all use casesBY INDUSTRYHealthcareFinancial servicesManufacturingGovernmentView all industriesView all solutionsResourcesEXPLORE BY TOPICAISoftware DevelopmentDevOpsSecurityView all topicsEXPLORE BY TYPECustomer storiesEvents & webinarsEbooks & reportsBusiness insightsGitHub SkillsSUPPORT & SERVICESDocumentationCustomer supportCommunity forumTrust centerPartnersView all resourcesOpen SourceCOMMUNITYGitHub SponsorsFund open source developersPROGRAMSSecurity LabMaintainer CommunityGitHub StarsArchive ProgramREPOSITORIESTopicsTrendingCollectionsEnterpriseENTERPRISE SOLUTIONSEnterprise platformAI-powered developer platformAVAILABLE ADD-ONSGitHub Advanced SecurityEnterprise-grade security featuresCopilot for BusinessEnterprise-grade AI featuresPremium SupportEnterprise-grade 24/7 supportPricingSearch/Sign inSign upAppearance settings You signed in with another tab or window. Reload to refresh your session. Dismiss alert androidndkRepository navigationCodeIssues131 (131)Pull requestsDiscussionsActionsProjectsWikiSecurity and qualityInsightsMore items [BUG] bionic: wcscspn()/wcspbrk() treat every wchar_t >= 0x100 as a match (Android 17, CP3A.260905.009) #2260New issueCopy linkNew issueCopy linkOpenOpen[BUG] bionic: wcscspn()/wcspbrk() treat every wchar_t >= 0x100 as a match (Android 17, CP3A.260905.009)#2260Copy linkLabelsbugDescriptionfrancisdbopened on Oct 12, 2026Issue body actionsDescription Device Pixel 7 Pixel 8a Nothing Phone 2 The public android17-release sources (android-17.0.0_r1, June 2026) build wcscspn/wcspbrk from external/llvm-libc, which is a plain nested loop over wchar_t and is correct. The code on the September builds is different (see "Mechanism"), so the regression was introduced between the June and September releases. int main(void) A sweep of every code point from U+0001 to U+10FFFF (skipping surrogates and the two set members) with wcscspn(L"<cp>\n", L"x\n") returns 0 instead of 1 for 1,111,808 code points: every one from U+0100 to U+10FFFF. U+0001 to U+00FF are correct. Reject set one character two or more characters, all < U+0100 (e.g. L"x\n", L"\xe9\n") two or more characters, at least one >= U+0100 haystack limited to U+0080..U+00FF Mechanism (from the shipped libc.so) One character: a plain compare loop. Correct. a2564: ldrb w8, [x9, x8] ; table[c] A character >= 0x100 cannot be in a set whose members are all < 0x100, so for wcscspn the scan must continue past it. The code stops instead. wcsspn has the same structure, and there stopping is the correct answer (the character is not in the keep set), which is why only the complement functions are wrong. wcspbrk is implemented on top of this scan and inherits the bug. I have checked and the NDK I'm using is currently supported Affected versions but i'll add both missing tests, and ideally try to see if i can find everywhere else we're missing a test that actually uses non-ascii! 🤦😕React with 😕1Reacted by Joaquín Vacas Verísimo👀React with 👀1Reacted by Joaquín Vacas Verísimofrancisdb commented on Oct 13, 2026 francisdbon Oct 13, 2026AuthorMore actionsThanks for the quick response. It's indeed unfortunate that the source is not available (yet).joaquinvacas commented on Oct 13, 2026 joaquinvacason Oct 13, 2026More actionsSorry if it sounds dramatic, because it's not. I'm just worried. Something feels wrong with this... source.android.com (in particular, https://source.android.com/docs/whatsnew/site-updates?year=2026#aosp-changes) has official communication on this topic. (i was going to say "you know you can just look at the source?", but android-latest-release seems to still be too old to have any of these changes from april :-( ) FWIW, android-latest-release is a manifest branch, and android17-release is the git branch. The android 17 sources for bionic are in https://android.googlesource.com/platform/bionic/+/refs/heads/android17-release.zenczykowski commented on Oct 13, 2026 zenczykowskion Oct 13, 2026More actionsYes, but where is the source code for Android 17 QPR1 which is what is actually running on Pixel and has been stable for over a month...👍React with 👍1Reacted by TangerineNightmarefrancisdb commented on Oct 13, 2026 francisdbon Oct 13, 2026AuthorMore actionsThere must be a better location to discuss these general issues?👍React with 👍1Reacted by David AllisonSign up for free to join this conversation on GitHub. Already have an account? Sign in to commentMetadataMetadataAssigneesNo one assignedLabelsbugTypeNo typeProjectsNo projectsMilestoneNo milestoneRelationshipsNone yetDevelopmentNo branches or pull requestsIssue actionsOpen in GitHub Copilot app Footer © 2026 GitHub, Inc. Footer navigation Terms Privacy Security Status Community Docs Contact Manage cookies Do not share my personal information You can’t perform that action at this time. |
A bug was reported concerning the behavior of the bionic library functions wcscspn() and wcspbrk() on Android 17 builds, identified as an issue in the C platform version CP3A.260905.009. The core issue is that these functions incorrectly treat any wide character greater than or equal to U+0100 as a match when scanning for delimiters, leading to premature termination of the search. This failure occurs when the reject set contains two or more characters that are all less than U+0100, causing the scanning mechanism to stop prematurely even when it should continue. This defect specifically impacts code that scans wide strings for ASCII delimiters, such as newline or wildcard characters, whenever the text contains non-ASCII characters like emojis, CJK, Cyrillic, Greek, or Latin Extended characters. The observed regression is rooted in the implementation mechanism of these functions. A detailed disassembly of wcscspn() reveals that when the implementation encounters a character greater than or equal to 0x100 while scanning against the reject set, the code incorrectly stops instead of continuing the scan. The logic for handling character sets appears flawed; the mechanism is designed to fall back to calling wcschr() for each haystack character if a character $\ge 0x100$ is encountered, but the current implementation exits prematurely. This issue affects wcspbrk() as well, since it relies on the result of the wcscspn() scan. Although wcsspn() itself has the correct structure for determining a match (i.e., the character is not in the keep set), the stopping behavior in the implementation is flawed, which consequently affects derived functions like wcspbrk(). This bug has tangible real-world consequences in applications. For instance, libraries like libwinevbs, which is a Unix build of Wine's vbscript engine, and FileSystem.MoveFolder experienced issues where path or string scanning for wildcards, such as using wcspbrk() with patterns containing non-ASCII characters, incorrectly identified characters $\ge 0x100$ as potential wildcards, leading to incorrect parsing and behavior. The discussion surrounding this issue also touches upon broader concerns regarding the management and transparency of the Android Open Source Project. There is acknowledgment that while a specific bug was identified, the broader challenges related to managing changes and fixes within the AOSP project, particularly concerning the source visibility and availability of specific versions, remain a point of discourse. The reported issue highlights the necessity of comprehensive testing—specifically requiring tests that utilize non-ASCII input—to catch such subtle, low-level implementation errors in core library functions. |