Merge pull request #6322 from hoshiumiarata/fix_mrb_ro_data_p

This commit is contained in:
Yukihiro "Matz" Matsumoto
2024-08-13 17:50:35 +09:00
committed by GitHub
+2 -3
View File
@@ -446,10 +446,9 @@ mrb_ro_data_p(const char *p)
struct mach_header *mhp;
#endif
mhp = _NSGetMachExecuteHeader();
unsigned long textsize, datasize;
unsigned long textsize;
char *text = (char*)getsegmentdata(mhp, SEG_TEXT, &textsize);
char *data = (char*)getsegmentdata(mhp, SEG_DATA, &datasize);
return text + textsize < p && p < data + datasize;
return text <= p && p < text + textsize;
}
#endif /* Linux or macOS */
#endif /* MRB_NO_DEFAULT_RO_DATA_P */