[PATCH] D33368: [libcxxabi][demangler] Fix a crash in the demangler

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


erik.pilkington added inline comments.


================
Comment at: src/cxa_demangle.cpp:3036
                         break;
-                    if (db.names.size() < 2)
+                    if (k1 <= k0)
                         return first;
----------------
compnerd wrote:
> I'm not sure how `k1` can be `<` than `k0`.  Isn't this effectively always going down the `==` path?  If I'm just mistaken, then I think that this needs a comment.
I agree that it should be impossible, but the previous version handled this case with the `if (db.names.size() < 2)` check, when really `db.names.size()` can only be 1 or greater. I think it makes more sense to be paranoid here, I trust this file about as far as I can throw it (And I can't throw it very far, its not a tangible object).


https://reviews.llvm.org/D33368





More information about the cfe-commits mailing list