vector<string>& words;
sort(words.begin(), words.end(), [](const string &str1, const string &str2) {
return str1.size() > str2.size();
});
我的目的是将 words 中的 string 按照长度排序 (words 中大概有 1k 个 string)
但是 lambda 函数中的比较如果是 >= 的话, 就会报错, heap buffer overflow
AddressSanitizer: heap-buffer-overflow on address 0x63000000fe08 at pc 0x000000411eff bp 0x7ffcfab095c0 sp 0x7ffcfab095b8
我的迷惑是 :
-
堆溢出? 怎么溢出的?
-
为什么 > 就可以?