Skip to content

Convert the Windows environment block to UTF-8 instead of copying narrow API bytes #526

Description

@LunaStev

env_read copies bytes from GetEnvironmentStringsA into the environment representation consumed by Wave. The narrow block is not guaranteed to contain UTF-8, and characters unavailable in that encoding may already be lost before copying. Unicode environment keys and values therefore need a wide-API conversion path independent of filesystem path handling.

Source evidence at the head of #520:

Acceptance:

  • Read GetEnvironmentStringsW and convert complete entries to UTF-8 while preserving the double-NUL-terminated block format.
  • Free the matching native block on success and every failure path.
  • Test Korean and supplementary-plane keys/values, an empty value, and destination capacities around the encoded byte length.
  • Preserve the environment block rules for special entries and add no libc dependency.

API/reference context: GetEnvironmentStrings.

Related: #385 and #427; #427 requests portable boundary tests, whereas this issue fixes the native encoding implementation.

Audit status: identified by static source inspection; the scenarios above have not been executed during this audit. The permalink fixes the reviewed revision; this report does not claim the defect was introduced by #520.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA problem that causes incorrect behavior or crashes.cross-platformIssues related to making Wave work seamlessly across multiple operating systems.help wantedThe issue requires extra attention or help from others.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions