Re: [PATCH] D16572: PR23057: fix use-after-free due to local token buffer in ParseCXXAmbiguousParenExpression

2016-02-03 Thread Alexey Bataev via cfe-commits
ABataev added a subscriber: ABataev. ABataev closed this revision. ABataev added a comment. Committed in http://reviews.llvm.org/rL259750 http://reviews.llvm.org/D16572 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

Re: [PATCH] D16572: PR23057: fix use-after-free due to local token buffer in ParseCXXAmbiguousParenExpression

2016-02-02 Thread David Majnemer via cfe-commits
majnemer accepted this revision. majnemer added a reviewer: majnemer. majnemer added a comment. This revision is now accepted and ready to land. LGTM http://reviews.llvm.org/D16572 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

Re: [PATCH] D16572: PR23057: fix use-after-free due to local token buffer in ParseCXXAmbiguousParenExpression

2016-02-02 Thread Dmitry Polukhin via cfe-commits
DmitryPolukhin updated this revision to Diff 46644. DmitryPolukhin added a comment. Use EOF token instead of copy buffer. This approach looks a bit more fragile but definitely more efficient, PTAL. http://reviews.llvm.org/D16572 Files: lib/Parse/ParseExprCXX.cpp

Re: [PATCH] D16572: PR23057: fix use-after-free due to local token buffer in ParseCXXAmbiguousParenExpression

2016-02-01 Thread David Majnemer via cfe-commits
majnemer added a subscriber: majnemer. majnemer added a comment. I believe this change is correct but I believe we can handle this a little more efficiently. I wonder if it would be better if we instead inserted a special EOF token at the end of `Toks`. If any errors occur, consume tokens

[PATCH] D16572: PR23057: fix use-after-free due to local token buffer in ParseCXXAmbiguousParenExpression

2016-01-26 Thread Dmitry Polukhin via cfe-commits
DmitryPolukhin created this revision. DmitryPolukhin added a reviewer: rjmccall. DmitryPolukhin added a subscriber: cfe-commits. To completely eliminate use-after-free in this place I had to copy tokens into new array and pass ownership. As far as I understand the code it is not possible to

Re: [PATCH] D16572: PR23057: fix use-after-free due to local token buffer in ParseCXXAmbiguousParenExpression

2016-01-26 Thread David Blaikie via cfe-commits
I don't fully understand your explanation. Is your change introducing a memory leak? (or was the old code causing a double free (if EnterTokenStream does take ownership of this argument)in addition to use-after-free?) On Tue, Jan 26, 2016 at 2:45 AM, Dmitry Polukhin via cfe-commits <

Re: [PATCH] D16572: PR23057: fix use-after-free due to local token buffer in ParseCXXAmbiguousParenExpression

2016-01-26 Thread Dmitry Polukhin via cfe-commits
DmitryPolukhin added a comment. I didn't introduce a leak because I pass ownership of the Buffer to EnterTokenStream (i.e. pass true as the last argument OwnsTokens). ASan also doesn't report a leak with my patch. Original code didn't have double free because it used call EnterTokenStream with