Skip to content

Instantly share code, notes, and snippets.

@orbitcowboy
orbitcowboy / crash_0001.cpp
Created August 9, 2014 18:15
Crash FlexeLint for C/C++ (Linux) Vers. 9.00k3
// Author Dr. Martin Ettl
// Date 2014-08-09
// -------------------------------------------------------------------------------------------------
//
// ./flint9 -v
// FlexeLint for C/C++ (Linux) Vers. 9.00k3, Copyright Gimpel Software 1985-2013
// FlexeLint was compiled with gcc and enabled address-sanitizer and undefined behavior santizier:
// gcc --sanitze=address --sanitze=undefined *.c -o flint9
// This file is able to crash the application.
// Call it with the following parameters:
@orbitcowboy
orbitcowboy / FlexeLint Valgrind output with crash
Created August 8, 2014 17:52
Information for the FlexeLint developers to fix a potential bug. FlexeLint crashes when scanning sources of cppcheck on Linux
Here is the valgrind output. It states that there is something wrong with FlexeLint. Take a look at the line (==8590== Invalid read of size 4):
_
const Token *expr1 = cond1->astOperand1();
/home/martin/cppcheck/lib/checkassignif.cpp 267 Error 40: Undeclared
identifier 'cond1'
/home/martin/cppcheck/lib/checkassignif.cpp 267 Error 10: Expecting a
structure or union
/home/martin/cppcheck/lib/checkassignif.cpp 267 Error 1013: Symbol
'astOperand1' not a member of class ''
/home/martin/cppcheck/lib/checkassignif.cpp 267 Error 118: Too few arguments
@orbitcowboy
orbitcowboy / A217574.hpp
Created October 11, 2012 15:15
Generate and print the sequence A217574 from http://oeis.org/A217574
// ------------------------------------------------------------------
/// Generate and print the sequence A217574 to a std::string.
/// Weblink: http://oeis.org/A217574
//
// Usage:
// ------
// unsigned int uiMax(25);
// std::cout << strPrint_A217574(200)) << std::endl;
//
// Output:
@orbitcowboy
orbitcowboy / A216983.cpp
Created September 27, 2012 19:54
C++ Version of OEIS sequence A216983
#include <iostream>
#include <string>
// ------------------------------------------------------------------
/// Generate and print the sequence A216983 to a std::string.
/// Weblink: http://oeis.org/A216983
//
// Usage:
// ------
// unsigned int uiMax(88);
// std::cout << PrintSequnce_A216983(uiMax)) << std::endl;