gregfelice commented on issue #2449: URL: https://github.com/apache/age/issues/2449#issuecomment-4875637832
Thanks for the thorough report and root-cause analysis, @AyoubKaz07 — this is valid, and the segfault makes it a must-fix. Confirming on current `master`: - `create_copy_options()` in both `ag_load_labels.c` and `ag_load_edges.c` still passes only `format` + `header` to `BeginCopyFrom`, so COPY's default comma delimiter is silently in effect — hence the silent corruption on pipe-delimited label files. - `process_edge_row()` accesses `fields[0]`..`fields[3]` with no check against `nfields`, so a row that parses into fewer fields (e.g. a pipe-delimited line read as one comma field) dereferences a bad pointer at `trim_whitespace(fields[1])` and crashes the backend. #2453 recently added the `nfields` parameter and hardened malformed-row handling, but this particular access path isn't guarded yet, so the crash still reproduces. Direction for a fix (all three are worth doing): 1. **Guard `process_edge_row` (and the label path) on `nfields`/column count** — turn the short-row crash into a clear `ereport(ERROR, ...)`. A reproducible segfault should never be reachable from user input. 2. **Add a `delimiter` option** to `create_copy_options()`, mirroring PostgreSQL COPY, plumbed through `load_labels_from_file` / `load_edges_from_file` so non-comma files are supported explicitly. 3. **Document the delimiter** requirement/option on the load functions. Your analysis already pinpoints the code — if you'd like to open a PR we'd be glad to review; otherwise this is on the list. Either way, thanks for catching it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
