Comments (11)
From memory this is because Windows malloc() initialises memory to zero, whereas Linux malloc() doesn't.
from gore.
Can you share the file?
from gore.
No i cannot unfortunately, i will try to do some reproduction myself to give you more info. This bug seems weird though because i see you are already masking the kind field?
from gore.
Does the Go library parse it correctly? You can either use it directly or use redress
"https://github.com/goretk/redress/releases" to extract the information. redress -type
should print out all types in a format you will find in the source code.
When using the python library, the data is transferred from Go to C to Python. The issue can be anywhere in this chain... I suspect the C layer...
from gore.
i'm trying with the C bindings now. I'll do the same logic as the python script
from gore.
the C library does NOT exhibit this issue with the following code:
include <stdio.h>
#include "libgore.h"
int main(int argc, char** argv)
{
int v;
char* fp = argv[1];
printf("loading: %s", fp);
v = gore_open(fp);
struct compilerVersion* c = gore_getCompilerVersion(fp);
printf("Compiler version: %s\n", c->name);
struct types* ts = gore_getTypes(fp);
printf("found %d types\n", ts->length);
for(int i =0; i < ts->length; i++) {
struct type* t = ts->types[i];
if(t->kind > 30) {
printf("got a bad one\n");
}
}
gore_close(fp);
return 0;
}
This suggest the python bindings have an issue. Or that the binary in the python package is malformed.
from gore.
This is just a complete guess here, but could this be a bignum and/or rounding problem?
x.ref numpy/numpy#8433
from gore.
i've seen stuff like this before when the field being assigned into is wider than the value being assigned and is not zeroed before.
EDIT: I looked, this is the bug. In the python wrapper library an unsigned long is used, but in the c library it's an unsigned int. This causes whatever random upper bits of the unsigned long to be undefined and occasionally these are set giving weird results. Must of been lucky that it only occured on linux
_Type._fields_ = [('kind', c_ulong),
struct type {
unsigned int kind;
from gore.
Ah cool thanks for sharing that! Also appreciate the library alot.
from gore.
I just pushed a new patch update to pypi https://pypi.org/project/pygore. Please let me know if 0.2.3 does not solve the issue.
from gore.
Tested. The bug is resolved.
from gore.
Related Issues (20)
- String extraction functionality
- MIPS support
- Fix the type parser
- Fix function line logic
- Don't skip built-in packages
- Use semver library for version compare
- panic: runtime error: index out of range [757869355] with length 33282560 HOT 2
- Fix map struct parsing for Go 1.7 to 1.13 HOT 1
- Extract build information if available
- GetTypes panic: runtime error: invalid memory address or nil pointer dereference. HOT 1
- support go1.18 HOT 2
- no pclntab located HOT 1
- GetGoRoot return ErrNoGoRootFound when running on windows
- Replacing extracted information HOT 3
- Confusion about LICENSE HOT 2
- gosym can provide the wrong address for funcs in cgo go binary HOT 14
- external linked pie elf binary can work without .gopclntab section
- codecov/codecov-action v1 will not work after 2024 Feb 1 HOT 1
- `GoVersionCompare` can provide wrong result
- Generate of moduledata timeout HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gore.