user1934980
user1934980

Reputation:

bad permission for mapped region at

I get segmentation fault when I try to do this. If I use valgrind to track the errors I get the message bad permission for mapped region. What does that mean ?

int *p;

p = (int *) f // f is a function

*p = 0x1234;

Upvotes: 0

Views: 1896

Answers (2)

Some programmer dude
Some programmer dude

Reputation: 409364

All code is in memory segments marked read (and execute) only.

Upvotes: 2

Kninnug
Kninnug

Reputation: 8053

(I assume you mean *p = 0x1234; instead of *ptr). You cannot change the address of a function because it's in read-only memory.

Upvotes: 1

Related Questions