Comments (4)
Minimal reproducer: Parsers.xparse(BigFloat, Vector(codeunits("1")), 1, 1)
.
from parsers.jl.
Seems like we should also be using Cstring
instead of Ptr
as the second argument type to mpfr_strtofr.
from parsers.jl.
Hmmmm, interesting. Yes, I've definitely been assuming that a String
or Vector{UInt8}
input source will have the implicit nul terminator byte already there for us. Do you happen to know if this is a new failure? Like, since the Memory changes in Base? Doe we not see a Buffer Overflow in 1.9? That would suggest that maybe something with the new Memory changes is not the same as before.
Does just changing teh ccall argument from Ptr{UInt8}
to Cstring
fix the ASAN warning? I believe that should ensure the NUL terminator byte is present no matter the input, so if that fixes it, then that sounds like a fine change to me.
from parsers.jl.
for i in 1:10^7
a = Vector(codeunits("123"))
ptr = pointer(a)
Base.unsafe_load(ptr)
Base.unsafe_load(ptr+1)
Base.unsafe_load(ptr+2)
if Base.unsafe_load(ptr+3) != 0
return i
end
end
returns nothing on 1.10.2 whilst on 1.11-alpha2 it returns numbers below 100.
So perhaps something has changed, though I don't think it's guaranteed that a vector has a null terminator.
I'm having a little trouble with my asan build right now, but I see this on 1.11-alpha2 so I don't think just changing Ptr
to Cstring
is going to work.
julia> a = for i in 1:10^7
a = Vector(codeunits("123"))
ptr = pointer(a)
Base.unsafe_load(ptr)
Base.unsafe_load(ptr+1)
Base.unsafe_load(ptr+2)
if Base.unsafe_load(ptr+3) != 0
return a
end
end
3-element Vector{UInt8}:
0x31
0x32
0x33
julia> unsafe_string(Base.cconvert(Cstring, pointer(a)))
"123\xec\xff\x7f"
Oddly, there is no cconvert(Cstring, Vector)
even though there is one for Cwstring
.
I think a safe thing to do is to just copy into a String and then change Ptr
to Cstring
as well for good measure.
from parsers.jl.
Related Issues (20)
- Unclear documentation for `getstring` HOT 6
- Documentation for `ReturnCode` is mangled
- Streamline `xparse` interface HOT 1
- Delete the master branch? HOT 1
- Parsers.jl v2.4.1 breaks InlineStrings.jl HOT 1
- Add Integration Tests for downstream packages HOT 2
- Use quotes to disambiguate empty and missing strings
- InlineStrings.jl tests fail on Parsers.jl `main` HOT 3
- Benchmark current main vs. current release
- Parsers.jl version 2.5 appears to break OpenML.jl HOT 4
- Re-enable JET
- Parsers reads out of bounds in `checkdelim!`
- quarto build broken on Parsers v2.5.7
- BoundsError for test that parses incorrect UUID HOT 1
- `groupmark` bugs HOT 1
- Automatic tagging disabled HOT 1
- `xparse` changed behavior after #127 (regression?) HOT 1
- Make it easier to modify behavior of `parse` / `tryparse` / `xparse2` HOT 2
- Ensure `decimal` being the same as `delim` is handled consistently
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 parsers.jl.