#5230·WasmEdge

PO help output hangs on descriptions containing words longer than the wrap width

Author: ProfTR55Created Jul 30, 2026Updated Jul 30, 2026

Description

ArgumentParser::help() does not return when an option or subcommand description contains a word longer than the available output width. Long URLs, hashes, paths, or identifiers can therefore make a WasmEdge tool hang while printing --help.

Steps to reproduce

Add a PO option whose description is a single 100-character word and print the parser help:

cpp
const std::string DescriptionText(100, 'x');
Option<Toggle> Opt{Description(DescriptionText)};
ArgumentParser Parser;
Parser.add_option("a"sv, Opt);
Parser.help(stdout);

Run the reproducer under a timeout:

bash
$ timeout 2s ./poTests --gtest_filter=Help.WrapsLongUnbrokenDescription
[ RUN      ] Help.WrapsLongUnbrokenDescription

The test remains in the running state until timeout terminates it.

Root cause

ArgumentParser::SubCommandDescriptor::indent_output() loops while the remaining description is wider than the output width. The loop only consumes input when find_last_of(' ', Width) finds a space. For a long unbroken word it returns std::string_view::npos, leaving Desc unchanged on every iteration.

Expected behavior

Help generation should always make progress. When no whitespace exists within the available width, the text should be hard-wrapped at the width boundary.

Actual behavior

Help generation enters an infinite loop and the process must be terminated.

Impact

Any WasmEdge tool using the PO argument parser can hang in its help path if a description includes an unbroken token longer than the wrap width.

Environment

Reproduced on Linux x86_64 from master at commit 77a76b72f4239ee9be37808f32d2975b4e5e50d7.