-
Be aware of subtle overflow
http://googleresearch.blogspot.com/2006/06/extra-extra-read-all-about-it-nearly.html We see the following form of code very often. But be aware of subtle overflow here. low + high can be larger than the maximum value of int range. Open ssh vunlerability was also due to subtle overflow.
Tags:
-
Blacklisting for XSS is stupid.
http://ha.ckers.org/xss.html Did you know.. XSS prevention using any kind of replace / blacklisting is stupid? Someone will find out crazy attack.
Tags:
-
Protocol buffer for flexible protocol definition.
http://code.google.com/p/protobuf/ http://code.google.com/apis/protocolbuffers/docs/overview.html See how Google implemented general RPC protocol infrastructure.
Tags:
-
Nice review on Java generics
http://www.ibm.com/developerworks/java/library/j-jtp07018.html Canonical example: Rule of thumb: Use an extends wildcard when you only get values out of a structure, use a super wildcard when you only put values into a structure, and don’t use a wildcard when you do both.
Tags:
-
C++ Post increment and pre increment
http://www.parashift.com/c++-faq-lite/operator-overloading.html#faq-13.14 C++ FAQ suggests the following for post increment. But actually is should be to prevent num++++ which semantically doesn’t make any sense. Similarily, operator+ should return const Number.
Tags:
-
Google announced C++ testing framework
http://code.google.com/p/googletest/ It’s licensed under new BSD license.
Tags:
-
Integer overflow and security
http://www.openssh.org/txt/preauth.adv See the change: diff -u -r1.18 auth2-chall.c — auth2-chall.c 19 Jun 2002 00:27:55 -0000 1.18 +++ auth2-chall.c 26 Jun 2002 09:37:03 -0000 @@ -256,6 +256,8 @@ authctxt->postponed = 0; /* reset */ nresp = packet_get_int(); + if (nresp > 100) + fatal(“input_userauth_info_response: nresp too big %u”, nresp); if (nresp > 0) { response =…
Tags:
-
Google Style Guide
http://code.google.com/p/google-styleguide/ Worth reading it throughly. Every major open-source project has its own style guide: a set of conventions (sometimes arbitrary) about how to write code for that project. It is much easier to understand a large codebase when all the code in it is in a consistent style. “Style” covers a lot of ground, from…
Tags:
-
destructor 정리
* public virtual dtor – 상속받을 수 있도록. – 어떤 클래스도 상속받지 않을 것이라는 확신이 있지 않는 한 상속 가능성을 열어 두기 위해. * protected non virtual dtor – 상속받을 수 있도록. – polymorphic destruction을 방지. * private dtor – 멤버 함수(delete this) 또는 friend인 함수에 의해서만 삭제가능하도록 통제 e.g.) scoped_ptr과 같은 경우 scoped_ptr자체를 외부에서…
Tags:
-
Pure virtual function with definition?
http://gotw.ca/gotw/031.htm pure virtual로 선언해놓고 define하는 destructor에 대한 설명입니다. class Foo { public: virtual ~Foo()=0; }; Foo::~Foo() { …. } 한마디로 말하면, abstract 클래스였으면 하는데 pure virtual method는 없을 때 씁니다. abstract였으면 한다는 건, 실제 Foo 클래스를 쓸 용도는 아니고 쓸려면 이 클래스를 상속받아서 새 클래스를 만든다음 새 클래스를 썼으면 한다는 의도를 표현하는 것입니다.
Tags: