[pkg-d-commits] [ldc] 86/211: Validate the __asm constraints.

Matthias Klumpp mak at moszumanska.debian.org
Sun Apr 23 22:36:12 UTC 2017


This is an automated email from the git hooks/post-receive script.

mak pushed a commit to annotated tag v1.1.0
in repository ldc.

commit 399962aa638f01b0e62a24f639ea017488b71a84
Author: LemonBoy <thatlemon at gmail.com>
Date:   Thu Oct 13 13:31:42 2016 +0200

    Validate the __asm constraints.
    
    Fixes #802.
---
 gen/naked.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gen/naked.cpp b/gen/naked.cpp
index e9a37a1..6fcf98c 100644
--- a/gen/naked.cpp
+++ b/gen/naked.cpp
@@ -435,6 +435,12 @@ DValue *DtoInlineAsmExpr(Loc &loc, FuncDeclaration *fd,
   LLType *ret_type = DtoType(type);
   llvm::FunctionType *FT = llvm::FunctionType::get(ret_type, argtypes, false);
 
+  // make sure the constraints are valid
+  if (!llvm::InlineAsm::Verify(FT, constraints)) {
+    e->error("__asm constraint argument is invalid");
+    fatal();
+  }
+
   // build asm call
   bool sideeffect = true;
   llvm::InlineAsm *ia = llvm::InlineAsm::get(FT, code, constraints, sideeffect);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-d/ldc.git



More information about the pkg-d-commits mailing list