[PATCH] D33393: [PATCH] Libcxxabi Demangler PR32890

Erik Pilkington via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 22 23:23:32 PDT 2017

erik.pilkington added a comment.

Could you please add more context lines in any future patches? Makes it easier to review!

I think we fixed the same problem at the same time, I have https://reviews.llvm.org/D33368 that also fixes this! The reason that inserting into db.names.back() sometimes results in a insertion out of bounds is that parse_type() can sometimes append multiple names into `db.names` (ie for a reference to a pack expansion). This results in db.names.back() no longer being the text `'lambda`, which makes inserting at +7 dangerous. I think we should handle this case by appending them one by one into the lambda's parameters, which is what my patch does. Do you agree that this is the right approach here?

Comment at: src/cxa_demangle.cpp:3080
+                  db.names.back().first.insert(db.names.back().first.begin()+7, t0, t1);
                 t0 = t1;
We shouldn't make progress here if something invalid happened, if the names.back().size() is less than 7 then we should just bail out and return first.


More information about the cfe-commits mailing list