I do love #golang #cgo for interfacing to non-go (C) library code and system features. Much nicer than #jni and easy to wrap both C strings and structs, and doing so both ways. This made it simple to use #coventry ipc from apollo as well as to run the libeXosip2 stack under go.
Fun experiment today with #RustLang and #Golang where I checked if it would be faster to compute a large number of sha256 hashes directly in go or by using #rust one of two ways: as a statically linked library with #cgo and as a separate process using unix-domain sockets for IPC. Turns out go is always faster, with my setup around 40%. I benchmarked pretty much all the crates I could find for it but go's "crypto/sha256" is damn fast.
CVE-2020-28367 (go) - Code injection in the go command with cgo before Go 1.14.12 and Go 1.15.5 allows arbitrary code execution at build time via malicious gcc flags specified via a #cgo directive. #nist
https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2020-28367
Hey #gopher|s,
I need your help:
I'm currently working on a project heavily involving cgo. Now I have a go function that gets a pointer and a length from a c lib. It needs to write byte data with the specific length into the c memory where the pointer points (yeah this is kind of a buffer you could say). How could I do this?