3 ms·
From the post: "I would like to touch a slightly different application of this technology - protect your software/data from being hacked." I wrote something s
by jim_lawless 15y ago
From the post:
"I would like to touch a slightly different application of this technology - protect your software/data from being hacked."
I wrote something similar that I posted to my blog a couple of years ago ( my blog post is titled "An Embedded Mini Interpreter" ).
While I had tinkered with making my own VM's with elaborate file-formats, the only data-structure I used for my VM was an array of integers that acted as indices to functions in a C program and an index to the array element next in line to be interpreted.
The interpreter would begin at the top of the array and would issue the function relative to the number in the current integer in the array. For some functions, I would encode data in the integer array. For the sake of example, I simply encoded a string for a "print string" function as a single character in each successive integer slot.
- RodgerTheGreat 15y agoYou've applied/discovered a technique called Threaded Code[1], common in Forth implementations and the basis of Return-Oriented Programming[2]. :) [1]http://en.wikipedia.org/wiki/Threaded_code [2]http://en.wikipedia.org/wiki/Return-oriented_programming