Skip to content

Instantly share code, notes, and snippets.

View submachine's full-sized avatar

Arjun Shankar submachine

  • Brno, Czech Republic
View GitHub Profile
@submachine
submachine / iconv-2byte-fuzzer.out
Created May 20, 2019 11:54
Output; iconv-2byte-fuzzer.sh (https://git.io/fj8xa) run on Fedora 29 with glibc-2.28-30.fc29.x86_64
HANG: ANSI_X3.110; echo -en "\x00\x23" | iconv -c -f ANSI_X3.110 -t "UTF-8//TRANSLIT//IGNORE"
HANG: ARMSCII-8; echo -en "\x00\xa1" | iconv -c -f ARMSCII-8 -t "UTF-8//TRANSLIT//IGNORE"
HANG: ASMO_449; echo -en "\x00\xa1" | iconv -c -f ASMO_449 -t "UTF-8//TRANSLIT//IGNORE"
HANG: BIG5; echo -en "\x00\x81" | iconv -c -f BIG5 -t "UTF-8//TRANSLIT//IGNORE"
HANG: BIG5HKSCS; echo -en "\x00\xff" | iconv -c -f BIG5HKSCS -t "UTF-8//TRANSLIT//IGNORE"
HANG: BRF; echo -en "\x00\xff" | iconv -c -f BRF -t "UTF-8//TRANSLIT//IGNORE"
HANG: BS_4730; echo -en "\x00\xff" | iconv -c -f BS_4730 -t "UTF-8//TRANSLIT//IGNORE"
OK: CP10007
OK: CP1125
HANG: CP1250; echo -en "\x00\x81" | iconv -c -f CP1250 -t "UTF-8//TRANSLIT//IGNORE"
@submachine
submachine / iconv-2byte-fuzzer.sh
Created May 17, 2019 12:57
Test iconv with every possible input combination of two bytes for every supported character set
#!/bin/sh -f
# Run iconv(1) tests with every possible input combination of two bytes.
# Copyright (C) 2019 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Arjun Shankar <arjun@redhat.com>, 2019.
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
@submachine
submachine / hdi-vs-irreligion.data
Created March 7, 2017 15:27
HDI vs Irreligion Data
# HDI vs Irreligion;
# Source:
# https://en.wikipedia.org/wiki/List_of_countries_by_irreligion
# https://en.wikipedia.org/wiki/List_of_countries_by_Human_Development_Index
# gnuplot command line:
# echo "set xlabel 'Irreligion (% of population)'; set xrange [0:100]; \
# set ylabel 'HDI'; set term png size 1024,768; \
# set output 'hdi-vs-irreligion.png'; \
# f(x) = a*x + b; a=0.003;b=0.7; \
# fit f(x) 'hdi-vs-irreligion.data' using 2:3 via a,b; \
@submachine
submachine / csv2muttalias.pl
Created July 3, 2015 11:27
Reads STDIN as an 'Outlook CSV' (e.g. contacts exported from GMail webUI); writes to STDOUT as mutt aliases
#!/usr/bin/perl
# Reads STDIN as 'Outlook CSV' (e.g. contacts exported from GMail webUI).
# Writes to STDOUT as mutt aliases
#
# Example usage:
#
# perl csv2muttalias.pl < contacts.csv >> ~/.muttrc
use strict;
@submachine
submachine / tst-stack-switch-x86_64-linux.c
Created February 16, 2015 23:37
A program that tests valgrind's '--max-stackframe' option on an x86-64 running Linux
/*
$ gcc -Wall -pedantic -o test-stack-switching test-stack-switching.c
$ valgrind ./test-stack-switching
Expected program output:
> 55
> 55
> 55
Expected valgrind output: Three warnings that look like;
@submachine
submachine / glibc-use-test-skeleton.sh
Last active August 29, 2015 14:07
[committed] script to automatically modify as many glibc test cases as possible into using test-skeleton.c
#!/bin/bash
SRC_DIR=~/src/glibc/
pushd $SRC_DIR &> /dev/null \
|| { echo Unable to enter directory $SRC_DIR 1>&2; exit 1; }
let blkl=0
let good=0
let main=0
@submachine
submachine / tst-append-ftell.c
Last active August 29, 2015 13:57
A sequence of calls to test ftell with fseek/rewind/fread/fwrite functions while in append mode.
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <unistd.h>
const char *data = "zzzzzzzzzz";
const char *more_data = "aaaaaaaaaa";
#define TEST_FILE_PATH "tst-rewind-ftell.out"
@submachine
submachine / glibc-tester.sh
Last active January 3, 2016 09:29
A [work in progress] script to fetch, build, and test fresh glibc sources.
#!/bin/bash
# TODO: Parse and report testsuite failures;
# fetch and execute gnulib testsuite.
GT_NAME=glibc-tester
GT_DIR=$HOME/.$GT_NAME
GT_CONFIG=$GT_DIR/config
if [ ! -d $GT_DIR ]; then
@submachine
submachine / hello-pthread.c
Last active December 28, 2015 18:48
A 'Hello World!' program unnecessarily using libpthread
/*
gcc -O0 -std=c99 -pedantic -Wall -Werror -lpthread \
-o hello-pthread hello-pthread.c
*/
/* Enable 2008 edition functionality of POSIX.1,
required for pthread_rwlock_* functions. */
#define _POSIX_C_SOURCE 200809L
#include <stdio.h>
@submachine
submachine / keep-pushing.c
Last active December 23, 2015 17:59
Keep pushing till we run out of stack area.
#include <stdio.h>
#include <string.h>
unsigned int stack_size;
struct huge_argument /* Not the verbal kind ;). */
{
char x[512];
};