Skip to content

Rollup of 25 pull requests #38697

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 57 commits into from
Dec 30, 2016
Merged
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
273cc30
Clarify phrasing of MSYS2 dependencies in README.md.
frewsxcv Dec 21, 2016
292d36f
Add missing doc examples for Builder
GuillaumeGomez Dec 20, 2016
f4bd94f
Add missing urls in Arc docs
GuillaumeGomez Dec 24, 2016
67cc77c
travis: Don't use -9 on gzip
alexcrichton Dec 26, 2016
3907b93
Add missing urls in AtomicBool docs
GuillaumeGomez Dec 26, 2016
917a9af
std: Clamp max read/write sizes on Unix
alexcrichton Dec 26, 2016
20abf05
And suddenly a german word :O
kellerkindt Dec 27, 2016
18d4928
PTX support
Dec 22, 2016
aac5ff7
fix ui test
Dec 23, 2016
fd97f5d
travis: Don't install ccache in containers
alexcrichton Dec 27, 2016
03d4fc5
travis: Remove extraneous /tmp/obj dirs
alexcrichton Dec 27, 2016
5cdf128
Document foreign variadic functions in TRPL and the reference.
frewsxcv Dec 27, 2016
f26e52e
compiletest: Don't limit all suites on Android
alexcrichton Dec 28, 2016
94d58c2
Add missing urls for atomic_int macros types
GuillaumeGomez Dec 28, 2016
ef8d5e1
Add missing urls for AtomicPtr
GuillaumeGomez Dec 27, 2016
88429dc
travis: Use `&&` intead of `;`
alexcrichton Dec 28, 2016
0f8e931
rustbuild: allow overriding list of LLVM targets to build
xen0n Dec 28, 2016
ee2abe8
Add missing apostrophe.
agl Dec 28, 2016
1825f80
Fix default terminfo code for reset (sg0 -> sgr0)
martijnvermaat Dec 28, 2016
57b53fd
Use "an" before "i32"
agl Dec 28, 2016
7046fea
rustbuild: Compile rustc twice, not thrice
alexcrichton Dec 25, 2016
fc3e49b
rustbuild: Move pretty test suites to host-only
alexcrichton Dec 28, 2016
b9038c8
rustdoc: Fix broken CSS for trait items
ollie27 Dec 29, 2016
c8e7b76
Add missing urls for atomic fn docs
GuillaumeGomez Dec 29, 2016
9958021
Add some more repos to cargotest
edunham Oct 13, 2016
a0f3c93
Fixes for new cargo test repos
alexcrichton Dec 29, 2016
900dd8a
rustbuild: Don't run pretty tests by default
alexcrichton Dec 29, 2016
8d50857
Check *all* errors in LLVMRustArchiveIterator* API
Dec 29, 2016
2ec294b
Fix typo in PartialOrd docs
lucis-fluxum Dec 29, 2016
2293ea5
Rollup merge of #37149 - edunham:more-cargotest, r=alexcrichton
alexcrichton Dec 30, 2016
26f28ec
Rollup merge of #38491 - GuillaumeGomez:builder_docs, r=frewsxcv
alexcrichton Dec 30, 2016
4e2e01e
Rollup merge of #38517 - frewsxcv:clarify-msys2-dependencies, r=alexc…
alexcrichton Dec 30, 2016
bcfd504
Rollup merge of #38559 - japaric:ptx2, r=alexcrichton
alexcrichton Dec 30, 2016
fe80a1d
Rollup merge of #38587 - GuillaumeGomez:arc_docs, r=frewsxcv
alexcrichton Dec 30, 2016
a68f886
Rollup merge of #38609 - alexcrichton:less-compress, r=japaric
alexcrichton Dec 30, 2016
41b601e
Rollup merge of #38611 - GuillaumeGomez:atomicbool_docs, r=frewsxcv
alexcrichton Dec 30, 2016
8623907
Rollup merge of #38622 - alexcrichton:read-lengths, r=sfackler
alexcrichton Dec 30, 2016
96c79c9
Rollup merge of #38628 - kellerkindt:patch-1, r=steveklabnik
alexcrichton Dec 30, 2016
1c2a6f9
Rollup merge of #38630 - frewsxcv:variadic, r=steveklabnik
alexcrichton Dec 30, 2016
9bb3543
Rollup merge of #38631 - alexcrichton:supafast, r=brson
alexcrichton Dec 30, 2016
6ccf039
Rollup merge of #38632 - alexcrichton:trim-travis, r=japaric
alexcrichton Dec 30, 2016
8b8ab85
Rollup merge of #38635 - GuillaumeGomez:atomicptr_docs, r=frewsxcv
alexcrichton Dec 30, 2016
332a4cc
Rollup merge of #38647 - alexcrichton:faster-android, r=brson
alexcrichton Dec 30, 2016
3c8a17f
Rollup merge of #38649 - GuillaumeGomez:atomicint_docs, r=frewsxcv
alexcrichton Dec 30, 2016
031aa58
Rollup merge of #38655 - alexcrichton:travis-and-then, r=brson
alexcrichton Dec 30, 2016
7d14e3a
Rollup merge of #38659 - agl:patch-1, r=apasel422
alexcrichton Dec 30, 2016
3f65c5d
Rollup merge of #38660 - martijnvermaat:terminfo-reset-typo, r=alexcr…
alexcrichton Dec 30, 2016
2068e1c
Rollup merge of #38662 - agl:patch-2, r=frewsxcv
alexcrichton Dec 30, 2016
2dc1a0a
Rollup merge of #38665 - alexcrichton:pretty-only-host, r=brson
alexcrichton Dec 30, 2016
1b4acae
Rollup merge of #38671 - ollie27:rustdoc_stab_em_div_fix, r=frewsxcv
alexcrichton Dec 30, 2016
c41256c
Rollup merge of #38674 - GuillaumeGomez:atomic_fn_docs, r=frewsxcv
alexcrichton Dec 30, 2016
3e36dd8
Rollup merge of #38676 - rkruppe:llvm-check-success, r=alexcrichton
alexcrichton Dec 30, 2016
19e187c
Rollup merge of #38693 - lucis-fluxum:partialord-typo-fix, r=stevekla…
alexcrichton Dec 30, 2016
334af88
Rollup merge of #38695 - alexcrichton:debug-appveyor, r=brson
alexcrichton Dec 30, 2016
ebea2ea
Merge branch 'rustbuild-llvm-targets' of https://github.com/xen0n/rus…
alexcrichton Dec 30, 2016
3eb459f
Merge branch 'aux-tests' of https://github.com/alexcrichton/rust into…
alexcrichton Dec 30, 2016
e484197
A few small test fixes and such from rollup
alexcrichton Dec 30, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Check *all* errors in LLVMRustArchiveIterator* API
Incrementing the `Archive::child_iterator` fetches and validates the next child.
This can trigger an error, which we previously checked on the *next* call to `LLVMRustArchiveIteratorNext()`.
This means we ignore the last error if we stop iterating halfway through.
This is harmless (we don't access the child, after all) but LLVM 4.0 calls `abort()` if *any* error goes unchecked, even a success value.
This means that basically any rustc invocation that opens an archive and searches through it would die.

The solution implemented here is to change the order of operations, such that
advancing the iterator and fetching the newly-validated iterator happens in the same `Next()` call.
This keeps the error handling behavior as before but ensures all `Error`s get checked.
  • Loading branch information
Robin Kruppe committed Dec 29, 2016
commit 8d50857a6fd38669d85d85ba5172c6262430f4af
35 changes: 26 additions & 9 deletions src/rustllvm/ArchiveWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,15 @@ struct RustArchiveMember {


struct RustArchiveIterator {
bool first;
Archive::child_iterator cur;
Archive::child_iterator end;
#if LLVM_VERSION_GE(3, 9)
Error err;

RustArchiveIterator() : err(Error::success()) { }
RustArchiveIterator() : first(true), err(Error::success()) { }
#else
RustArchiveIterator() : first(true) { }
#endif
};

Expand Down Expand Up @@ -120,6 +123,7 @@ LLVMRustArchiveIteratorNew(LLVMRustArchiveRef ra) {
rai->cur = ar->child_begin(rai->err);
if (rai->err) {
LLVMRustSetLastError(toString(std::move(rai->err)).c_str());
delete rai;
return NULL;
}
#endif
Expand All @@ -129,27 +133,40 @@ LLVMRustArchiveIteratorNew(LLVMRustArchiveRef ra) {

extern "C" LLVMRustArchiveChildConstRef
LLVMRustArchiveIteratorNext(LLVMRustArchiveIteratorRef rai) {
if (rai->cur == rai->end) return nullptr;

// Advancing the iterator validates the next child, and this can
// uncover an error. LLVM requires that we check all Errors,
// so we only advance the iterator if we actually need to fetch
// the next child.
// This means we must not advance the iterator in the *first* call,
// but instead advance it *before* fetching the child in all later calls.
if (!rai->first) {
++rai->cur;
#if LLVM_VERSION_GE(3, 9)
if (rai->err) {
LLVMRustSetLastError(toString(std::move(rai->err)).c_str());
return NULL;
}
if (rai->err) {
LLVMRustSetLastError(toString(std::move(rai->err)).c_str());
return nullptr;
}
#endif
if (rai->cur == rai->end)
return NULL;
} else {
rai->first = false;
}

if (rai->cur == rai->end) return nullptr;

#if LLVM_VERSION_EQ(3, 8)
const ErrorOr<Archive::Child>* cur = rai->cur.operator->();
if (!*cur) {
LLVMRustSetLastError(cur->getError().message().c_str());
return NULL;
return nullptr;
}
const Archive::Child &child = cur->get();
#else
const Archive::Child &child = *rai->cur.operator->();
#endif
Archive::Child *ret = new Archive::Child(child);

++rai->cur;
return ret;
}

Expand Down