This fixes a bug in the unreleased commit f8ba084b3 (stty: don't treat
baud rates of (speed_t) -1 as invalid, 2026-10-18).

* src/speedgen: Set valid to true in the returned speed_desc when the
speed is supported.
* tests/stty/stty.sh: Add a test case using the exta and extb speeds.

Discovered by Anthropic's OSS Scanner, as bug ANT-2026-D5MIB4OA.
---
 src/speedgen       |  2 +-
 tests/stty/stty.sh | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/speedgen b/src/speedgen
index 2629c0baa..fca59c611 100755
--- a/src/speedgen
+++ b/src/speedgen
@@ -89,7 +89,7 @@ EOF
 while read n; do
   printf '#  ifdef B%s\n'\
 '    case %s:\n'\
-'      return (struct speed_desc) { .baud = B%s, .valid = false };\n'\
+'      return (struct speed_desc) { .baud = B%s, .valid = true };\n'\
 '#  endif\n' "$n" "$n" "$n"
 done < "$tmp" >> "$out"
 
diff --git a/tests/stty/stty.sh b/tests/stty/stty.sh
index 5bfc17603..99a030be6 100755
--- a/tests/stty/stty.sh
+++ b/tests/stty/stty.sh
@@ -95,6 +95,20 @@ for W in $(seq 80 90); do
   test "$output_width" -le "$W" || fail=1
 done
 
+# Make sure that the "exta" speed is supported, along with its
+# numeric value.
+stty exta || fail=1
+stty 19200 || fail=1
+stty ispeed 19200 ospeed 19200 || fail=1
+stty $(cat $saved_state) || fail=1
+
+# Make sure that the "extb" speed is supported, along with its
+# numeric value.
+stty extb || fail=1
+stty 38400 || fail=1
+stty ispeed 38400 ospeed 38400 || fail=1
+stty $(cat $saved_state) || fail=1
+
 # Ensure we support varied numeric forms
 # with appropriate rounding
 if stty ispeed '9600'; then
-- 
2.56.1


Reply via email to