Comments (12)
If I compile with -fstrict-aliasing -Wstrict-aliasing=2
, I get some useful warnings - see https://gist.github.com/gszr/84b12df6c5401b4e64fe5e5739405722.
Also, I've tested with this changeset, that refactors some of the "aliasing", and verified it fixes the issue: https://github.com/gszr/lua-protobuf/pull/1/files
(I am not familiar with the library's code, so this was just a proof of concept to verify some assumptions)
from lua-protobuf.
It seems that caused by the lack of Lua stack space, you could try the latest HEAD version of git to see whether it fixed.
from lua-protobuf.
If I compile with
-fstrict-aliasing -Wstrict-aliasing=2
, I get some useful warnings - see https://gist.github.com/gszr/84b12df6c5401b4e64fe5e5739405722.Also, I've tested with this changeset, that refactors some of the "aliasing", and verified it fixes the issue: https://github.com/gszr/lua-protobuf/pull/1/files (I am not familiar with the library's code, so this was just a proof of concept to verify some assumptions)
Oh, I see this fix, so it's caused by the optimization of gcc? a pr is welcome :-)
from lua-protobuf.
@starwing - can you take a look at the PR?
FWIW, we might want to disable the -fstrict-aliasing
, since that same pattern I remvoed in the PR appears in other places. Doing -O2
without disabling strict-aliasing seems unsafe, and the segfault can happen in other places.
from lua-protobuf.
@gszr it seems the gcc feature, not bug. To compete with clang for performance ... I will accept this pr
from lua-protobuf.
I have made a new commit, please try it out and see whether the warnings still exist.
from lua-protobuf.
@starwing - I will give this a shot soon and report back.
from lua-protobuf.
@starwing I can confirm that fixes the specific aliasing issue I reported. No segfaults with the same testing.
Also, it'd be a good exercise to go through other aliasing issues as reported by https://gist.github.com/gszr/84b12df6c5401b4e64fe5e5739405722 and fix them. These result in undefined behavior if the -fstrict-aliasing
is on.
from lua-protobuf.
Also, could you draft a new patch release of the library?
from lua-protobuf.
I have made a new commit which fix the strict aliasing issue, could you check it out and test whether it works?
from lua-protobuf.
@gszr new version drafted.
from lua-protobuf.
@starwing The issue is gone (https://gist.github.com/gszr/05b43652556e0a1f8dd570806a8e914e) - thanks for the fix and new version (could you also update the GH releases page? :)
from lua-protobuf.
Related Issues (20)
- 当include_imports和unknow_import都为true时,会出现错误
- 希望支持 oneof 的 DefaultMessageDecoding HOT 1
- bad argument #1 to 'encode' (type 'Person' does not exists) HOT 8
- pb.so causes nginx to segfault HOT 4
- 循环引用场景下会导致stack overflow HOT 1
- pb.decode() 导致 out of memory HOT 1
- pb中uint64过长, 在decode时会被科学计数法 HOT 1
- pb.decode 问题。 HOT 1
- Option name expected
- Proto - JSON transcoder HOT 2
- nested message with default values regression HOT 1
- protobuf3 optional: configurable "optional_" prefix HOT 3
- pb.encode double/float 类型数据,在C++里ParseFromString会有问题。 HOT 2
- Decode to a temporary message to extract or change data
- 请问下java的.proto文件存在import引用其它文件如何加载 HOT 1
- Running on ESP32: load() function not working HOT 3
- what causes change in state? HOT 1
- loading fail. HOT 1
- Name resolution is failing 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 lua-protobuf.