Skip to content

fix: resolve nil panic, silent error swallow, and unsafe type assertions in table parser - #32

Open
belowzeroff wants to merge 1 commit into
DataIntellectTech:masterfrom
belowzeroff:fix/parser-nil-panic-error-propagation
Open

fix: resolve nil panic, silent error swallow, and unsafe type assertions in table parser#32
belowzeroff wants to merge 1 commit into
DataIntellectTech:masterfrom
belowzeroff:fix/parser-nil-panic-error-propagation

Conversation

@belowzeroff

Copy link
Copy Markdown

Summary

Three fixes in the kdb+ table parser layer:

  1. standardColumnParser silently swallowed parser errors — For kdb.K0 (mixed list) columns, stringParser could return an error (e.g. non-string column), but the code had //return nil, fmt.Errorf(...) commented out, silently returning a potentially empty/nil slice. Changed signature to (interface{}, error) and propagated errors to both callers.

  2. correctedTableIndex could panic on nilcorrectedIndex returns nil for some inputs, but the result was unconditionally type-asserted as *(*kdb.K). Now guarded with a nil check before assertion.

  3. parseFrameName used unsafe .Data.([]interface{}) type assertions — For kdb.KC (char vector) the underlying Data is string, not []interface{}, and for other non-K0 types Data is a typed slice. Replaced with the safe key.Index() method.

Verification

  • go build ./... succeeds
  • go vet ./... shows no new warnings

…ons in table parser

- standardColumnParser now returns (interface{}, error) instead of silently
  swallowing stringParser errors (was a commented-out return)
- correctedTableIndex guards against nil from correctedIndex before
  type assertion (potential panic)
- parseFrameName replaces unsafe .Data.([]interface{}) with safe
  key.Index() method, avoiding panic on kdb.KC type
@belowzeroff
belowzeroff force-pushed the fix/parser-nil-panic-error-propagation branch from 21fa10a to 51a7d49 Compare July 23, 2026 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant