Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault on orc when echo'ing decoded object #62

Closed
HugoGranstrom opened this issue Feb 4, 2023 · 1 comment · Fixed by #66
Closed

Segfault on orc when echo'ing decoded object #62

HugoGranstrom opened this issue Feb 4, 2023 · 1 comment · Fixed by #66

Comments

@HugoGranstrom
Copy link

When decoding an object on orc it segfaults when echoing the object. It works for refc but not on orc (tested on 1.6.10 and devel). Reproducing code:

import toml_serialization

type NbConfig* = object
  srcDir*, homeDir*: string

let f = readFile("nimib.toml")

let t = Toml.decode(f,  NbConfig, "nimib")

echo t # error here

nimib.toml:

[nimib]
srcDir = "docsrc"
homeDir = "docs"

Output:

Traceback (most recent call last)
/home/hugo/code/nim/nimib/x_toml.nim(10) x_toml
/home/hugo/.choosenim/toolchains/nim-#devel/lib/std/private/miscdollars.nim(25) $
/home/hugo/.choosenim/toolchains/nim-#devel/lib/system/alloc.nim(1043) alloc
/home/hugo/.choosenim/toolchains/nim-#devel/lib/system/alloc.nim(859) rawAlloc
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
Segmentation fault (core dumped)

Expected output:

(srcDir: "docsrc", homeDir: "docs")
@jangko
Copy link
Collaborator

jangko commented Feb 16, 2023

Thank you for reporting this, this is actually a severe bug[s] in Nim when orc enabled. Somehow var param stop working after certain depth of indirect recursion.

This bug have not reported to Nim dev team because it is very hard to isolate and reproduce outside nim-serialization framework. But because it has appear consistently in several nim-serialization derived libraries, I think it's time to look deeper into this.

For the time being, you can stick with refc that what we also doing because orc breaks a lot of our libraries.

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 a pull request may close this issue.

2 participants