There was a case study in Backpacker magazine a while ago of several cases where people got into survival situations and managed to get back out again. One case was of a guy in Alaska (I would consider him a bit of a hermit) who got trapped when the winter came early and the river froze, approximately a month earlier than usual. He had lots of supplies in his canoe, he just could no longer use it. Temperatures were in the minus 40's and he was north of the tree line. He managed to hike out (over 100 kilometres, IIRC) collecting arctic willows (extremely stunted willow trees that are the only form of wood that grows that far north) until he reached the tree line, found a cabin and broke in, found a satellite phone and called the owner of the cabin, explained his predicament and identified himself. The cabin owner told him to make use of anything he needed and alerted the SAR authorities.
So it does happen even to those who are extremely well-prepared. I guess most prosecutors would look at the intent. I guess any legal system that is based on the assumption that the average Joe (no pun intended) is prepared to die rather than break the law is fundamentally flawed.
If it were me, I would immediately make every effort to alert the owner and/or the authorities. Secondly (well, thirdly, after ensuring my own survival), I would try to make it clear that I was not trying to steal anything - writing your name and address on a piece of paper and pinning it to the wall, for example. True, a thief could do that and then take down the note when he was ready to leave; but the more effort you make to be noticed, the more difficult it will be for a prosecutor to show malicious intent.
_________________________
"The mind is not a vessel to be filled but a fire to be kindled."
-Plutarch