Skip to content

Instantly share code, notes, and snippets.

@piroor
Last active December 31, 2015 14:49
Show Gist options
  • Save piroor/8002725 to your computer and use it in GitHub Desktop.
Save piroor/8002725 to your computer and use it in GitHub Desktop.
Crash firefox by js-ctypes (run in the scratch pad or the browser console)
(function(){
Components.utils.import('resource://gre/modules/ctypes.jsm');
var library = ctypes.open(ctypes.libraryName('nss3'));
var PR_Free = library.declare(
'PR_Free',
ctypes.default_abi,
ctypes.void_t,
ctypes.voidptr_t
);
var ptr = new ctypes.voidptr_t(0123);
PR_Free(ptr);
})();
(function() {
Components.utils.import('resource://gre/modules/ctypes.jsm');
var lib = ctypes.open(ctypes.libraryName('msvcr100'));
var free = lib.declare(
'free',
ctypes.default_abi,
ctypes.void_t,
ctypes.voidptr_t // ptr
);
free(new (new ctypes.PointerType(ctypes.int))(123456789));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment