Personal channel of @lancern
Topics: programming, hacking, memes, life, and more. Forward anything as you wish.
Join the discussion group for more fun.
Discord: https://discord.gg/RwUx9et7
Topics: programming, hacking, memes, life, and more. Forward anything as you wish.
Join the discussion group for more fun.
Discord: https://discord.gg/RwUx9et7
#cpp #cpp26 String interpolation
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3412r0.pdf
tl;dr example
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3412r0.pdf
tl;dr example
Point getCenter();
std::string a = f"Center is: {getCenter()}"; // No dangling risk.
auto b = f"Center is: {getCenter()}"; // No dangling problem with P3398
size_t len = f"Center is: {getCenter()}".size(); // Works with P3298
std::println(f"Center is: {getCenter()}"); // Uses optimal overload of println
std::cout << f"Center is: {getCenter()}"; // Uses optimal overload of operator<<
祝各位订户乙巳年新春快乐!
Happy Chinese New Year!
Happy Chinese New Year!
https://seclists.org/oss-sec/2025/q1/48
tl;dr
glibc assert() 内部使用下面的结构存储 assert 失败消息:
这个结构会使用mmap分配出来,但是在计算分配大小时只计算了msg中的字符串的大小,没有考虑size字段的大小。当字符串的大小与页面大小的某个整数倍相差在4字节以内时便会发生缓冲区溢出。
tl;dr
glibc assert() 内部使用下面的结构存储 assert 失败消息:
struct abort_msg_s
{
unsigned int size;
char msg[0];
};
这个结构会使用mmap分配出来,但是在计算分配大小时只计算了msg中的字符串的大小,没有考虑size字段的大小。当字符串的大小与页面大小的某个整数倍相差在4字节以内时便会发生缓冲区溢出。
What Every Hacker Should Know About TLB Invalidation [pdf] https://grsecurity.net/h2hc_2024_what_every_hacker_should_know_TLB_invalidation.pdf
P0149R1: Generalised member pointers
一个有趣的语言提案,简单来说就是允许数据成员指针指向成员的成员。给定一段代码:
如果我们要构造一个类型为
由于非虚基类也可以看作是子类中的一个成员,因此本提案还额外支持这样的类型转换:
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p0149r1.pdf
一个有趣的语言提案,简单来说就是允许数据成员指针指向成员的成员。给定一段代码:
struct Foo { int a; };
struct Bar { Foo x; int y; };
如果我们要构造一个类型为
int Bar::*
的数据成员指针,目前只能得到一个指向 Bar::y
成员的指针。这篇提案说我们不妨扩展一下数据成员指针的能力让一个 int Bar::*
也可以指向 Bar::x::a
。具体的做法是让数据成员指针能参与获取成员运算,即可以作为点操作符、-> 操作符和 [] 操作符的左操作数,例如:Foo Bar::*p1 = &Bar::x;
int Bar::*p2 = p1.a; // <--
由于非虚基类也可以看作是子类中的一个成员,因此本提案还额外支持这样的类型转换:
struct A {};
struct B : A {};
struct C { B b; };
A C::*ptr = &C::b; // B C::* to A C::* conversion
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p0149r1.pdf