NO-MERCY Posted July 15, 2015 Report Posted July 15, 2015 A Collection of Examples of 64-bit Errors in Real ProgramsExample 1. Buffer overflowExample 2. Unnecessary type conversionsExample 3. Incorrect #ifdef'sExample 4. Confusion of int and int*Example 5. Using deprecated (obsolete) functionsExample 6. Truncation of values at an implicit type conversionExample 7. Undefined functions in CExample 8. Remains of dinosaurs in large and old programsExample 9. Virtual functionsExample 10. Magic constants as parametersExample 11. Magic constants denoting sizeExample 12. Stack overflowExample 13. A function with a variable number of arguments and buffer overflowExample 14. A function with a variable number of arguments and wrong formatExample 15. Storing integer values in doubleExample 16. Address arithmetic. A + B != A - (-Example 17. Address arithmetic. Signed and unsigned types.Example 18. Address arithmetic. Overflows.Example 19. Changing an array's typeExample 20. Wrapping a pointer in a 32-bit typeExample 21. Memsize-types in unionsExample 22. An infinity loopExample 23. Bit operations and NOT operationExample 24. Bit operations, offsetsExample 25. Bit operations and sign extensionExample 26. Serialization and data exchangeExample 27. Changes in type alignmentExample 28. Type alignments and why you mustn't write sizeof(x) + sizeof(y)Example 29. Overloaded functionsExample 30. Errors in 32-bit units working in WoW64AbstractThis article is the most complete collection of examples of 64-bit errors in the C and C++ languages. The article is intended for Windows-application developers who use Visual C++, however, it will be useful for other programmers as well.IntroductionOur company OOO "Program Verification Systems" develops a special static analyzer Viva64 that detects 64-bit errors in the code of C/C++ applications. During this development process we constantly enlarge our collection of examples of 64-bit defects, so we decided to gather the most interesting ones in this article. Here you will find examples both taken directly from the code of real applications and composed synthetically relying on real code since such errors are too "extended" throughout the native code.The article only demonstrates various types of 64-bit errors and does not describe methods of detecting and preventing them. If you want to know how to diagnose and fix defects in 64-bit programs, please see the following sources:Lessons on development of 64-bit C/C++ applications [1];About size_t and ptrdiff_t [2];20 issues of porting C++ code on the 64-bit platform [3];PVS-Studio Tutorial [4];A 64-bit horse that can count [5].You may also try the demo version of the PVS-Studio tool that includes the Viva64 static code analyzer which detects almost all the errors described in this article. The demo version of the tool can be downloaded here.Article as PDF By NO-MERCY : File: A Collection of Examples of 64-bit Errors in Real Programs.pdf CRC-32: 83a44d07 MD4: fce9ce801355066291dbb909122303b5 MD5: a4860ed0e570d9b1f18223f57dbef54a SHA-1: ee39016950c6ecc5a09542a40b141f641b036e73Pages : 40size : 1.88 MBDownload : http://www.4shared.com/office/ZlJBYgdxba/A_Collection_of_Examples_of_64.htmlRegardsSource : http://www.viva64.com/en/a/0065/29.06.2010 by : Andrey Karpov 1 Quote