Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
github.com/leeychee/mlayout
Package mlayout try to describe golang type's memory layout, especially struct's. According to language's implements, different order of fields use different memory layout, so different memory use ratio sometimes.
Here is a simple example, two structs with different fields order.
type t1 struct {
a bool
b int
c bool
}
type t2 struct {
a bool
b bool
c int
}
fmt.Printf("t1:\n%s\n", mlayout.Layoutof(t1{}))
fmt.Printf("t2:\n%s", mlayout.Layoutof(t2{}))
// Output:
// t1:
// x_______
// xxxxxxxx
// x_______
// t2:
// xx______
// xxxxxxxx
So we could try to imporve the struct's use ratio of memory with this, by adjusting struct's fields order.
go get -u github.com/leeychee/mlayout
For now, you can use the lib to get a type's use ratio of memory, and ascii image.
type t1 struct {
a bool
b int
c bool
}
l := mlayout.Layoutof(t1{})
fmt.Printf("t1's use ratio is %.2f", l.UseRatio())
fmt.Printf("t1's acsii image is: \n%s\n", l)
Maybe, we could build a cmd tool to analysis structs, and give some advices.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.