I am saying that it is out of my control, as it is done by code I did not write. So the metatable check works but the subsequent rawlen() fails. luaL_checkudata() does not prevent a user from causing a segfault if they match up your mt with a very small userdata...
Also, Coda, I said in my original posting that would seem a bit unclear to store the hidden userdata within a table to associate to the userdata that gets exposed. It makes its access weirder and a bit unclear to someone reviewing the code later -- I'm just wondering if pucrio can comment on if this would be a simple addition that would make sense. If anything, storing it in a table would mean using more memory (assuming this suggestion is possible).