Skip to content

_winapi.LCMapStringEx fails when encountering a string containing null characters #106844

Closed
@finnagin

Description

@finnagin

Bug report

This bug was encountered when working through gh-106816, specifically this comment chain.

_winapi.LCMapStringEx() raises the error ValueError: embedded null character when passed a string containing a null character.

This can be reproduced by running the following:

import _winapi
_winapi.LCMapStringEx('abc\x00def')

From the discussion in the linked PR it looks like the LCMapStringEx implementaion in 3.11 has already been improved to handle null characters and so maybe the same change can be brought forward into the 3.12 and 3.13 implementations?

Your environment

  • CPython versions tested on: 3.13.0a0
  • Operating system and architecture: Windows 11 on amd64

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixes3.13bugs and security fixesOS-windowsextension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions