mirror of
https://github.com/deepseek-ai/DeepGEMM.git
synced 2026-11-05 00:47:26 +00:00
[PR #286] [CLOSED] fix: add sscanf return value check to prevent uninitialized value return #344
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
deepseek-ai/DeepGEMM#344
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/deepseek-ai/DeepGEMM/pull/286
Author: @hobostay
Created: 2/9/2026
Status: ❌ Closed
Base:
main← Head:fix/sscanf-return-value-check📝 Commits (1)
8774365fix: add sscanf return value check to prevent uninitialized value return📊 Changes
1 file changed (+4 additions, -1 deletions)
View changed files
📝
csrc/utils/system.hpp(+4 -1)📄 Description
Summary
This PR fixes a potential bug in
csrc/utils/system.hppwhere the return value ofstd::sscanfwas not being checked when parsing integer environment variables.Problem
In the
get_env<int>()function template,std::sscanfwas used to parse an environment variable string as an integer, but the return value was never checked. If the environment variable contains a value that cannot be parsed as an integer (e.g., "abc", "12.3", or an empty string),sscanffails and thevaluevariable remains uninitialized. This uninitialized value is then returned, leading to undefined behavior.Solution
Added a check for
sscanf's return value (which should be 1 for successful parsing of one integer). If parsing fails, the function now returns the provided default value instead of the uninitialized variable.Changes
Test plan
Impact
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.