Comments (4)
According to https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/sanitizer.html#memorysanitizer you need to build with -Zbuild-std
in order for initializations inside the standard library to be understood by MemorySanitizer, otherwise you get false positives. That looks like what this is because building with -Zbuid-std
does not report any uninitialized accesses.
$ cargo clean
$ export RUSTFLAGS='-Zsanitizer=memory -Zsanitizer-memory-track-origins'
$ cargo run -Zbuild-std --target x86_64-unknown-linux-gnu --release
from yaml-rust.
This crate contains zero unsafe code so the root cause is almost surely not in this crate.
from yaml-rust.
linked hashmap does though
https://github.com/contain-rs/linked-hash-map/blob/4f681be6f3b1b2c7d67647ce3abbe48470e20855/src/lib.rs#L73
from yaml-rust.
This reproduces without linked-hash-map though, so it looks like an LLVM or rustc bug. Reduced somewhat:
enum Token {
DocumentStart,
#[allow(dead_code)]
Tag(String, String),
}
fn main() {
let _ = peek_token(&mut None);
if process_directives(&mut None).is_err() {
let _ = process_directives(&mut None);
}
skip(&mut None);
}
fn peek_token(token: &mut Option<Token>) -> Result<&Token, String> {
*token = Some(*Box::new(Token::DocumentStart));
Ok(token.as_ref().unwrap())
}
fn skip(token: &mut Option<Token>) {
*token = None;
}
fn process_directives(token: &mut Option<Token>) -> Result<(), String> {
loop {
match peek_token(token)? {
Token::Tag(..) => {}
_ => break,
}
skip(token);
}
Ok(())
}
$ cargo build --release && valgrind target/release/testing
Compiling testing v0.0.0
Finished release [optimized] target(s) in 0.25s
==12801== Memcheck, a memory error detector
==12801== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==12801== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==12801== Command: target/release/testing
==12801==
==12801== Conditional jump or move depends on uninitialised value(s)
==12801== at 0x10D8E3: testing::parser_process_directives (in /git/testing/target/release/testing)
==12801== by 0x10D3B6: testing::main (in /git/testing/target/release/testing)
==12801== by 0x10DAC2: std::rt::lang_start::{{closure}} (in /git/testing/target/release/testing)
==12801== by 0x115887: {{closure}} (rt.rs:52)
==12801== by 0x115887: do_call<closure-0,i32> (panicking.rs:297)
==12801== by 0x115887: try<i32,closure-0> (panicking.rs:274)
==12801== by 0x115887: catch_unwind<closure-0,i32> (panic.rs:394)
==12801== by 0x115887: std::rt::lang_start_internal (rt.rs:51)
==12801== by 0x10D971: main (in /git/testing/target/release/testing)
==12801==
==12801==
==12801== HEAP SUMMARY:
==12801== in use at exit: 0 bytes in 0 blocks
==12801== total heap usage: 12 allocs, 12 frees, 2,561 bytes allocated
==12801==
==12801== All heap blocks were freed -- no leaks are possible
==12801==
==12801== Use --track-origins=yes to see where uninitialised values come from
==12801== For lists of detected and suppressed errors, rerun with: -s
==12801== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
from yaml-rust.
Related Issues (20)
- Add support for YAML 1.1 HOT 1
- Support alternate line endings
- Bug in anchor handling? HOT 2
- Panic uninitialised linked hash map HOT 2
- can not part ref HOT 1
- Doesn't seem possible to iteratate over results HOT 3
- misleading? HOT 1
- is it wasm compatible? HOT 1
- Dupliacte keys are not detected as invalid YAML
- Add API to emit YAML strings (i.e. `need_quotes` and `escape_str`)
- tabs are not allowed as the first character of a block scalar
- `Parser` parses empty scalar as '~' HOT 1
- Support no-std with alloc crate
- Integration with google oss-fuzz fuzzing service
- Maintainers HOT 8
- unsafe-libyaml looks... unsafe? HOT 1
- Dynamically choosing a YAML document path? HOT 1
- `True` and `False` boolean literals seem to be parsed as strings HOT 2
- Is this crate maintained? HOT 4
- Read This First ~ Switch to the actively maintained yaml-rust2 fork
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 yaml-rust.