Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

兄弟-1索引下标是怎么通过测试的 #90

Open
weyenrooney opened this issue Feb 9, 2022 · 3 comments
Open

兄弟-1索引下标是怎么通过测试的 #90

weyenrooney opened this issue Feb 9, 2022 · 3 comments

Comments

@weyenrooney
Copy link

gridworld.py
420行
_LIB.env_get_info(self.game, -1, b"global_minimap",
buf.ctypes.data_as(ctypes.POINTER(ctypes.c_float)))

c++ 712行

void GridWorld::get_info(GroupHandle group, const char *name, void *void_buffer) {
// for more information from the engine, add items here

std::vector<Agent*> &agents = groups[group].get_agents();
@Kipsora
Copy link
Collaborator

Kipsora commented Feb 9, 2022

It appears to be a bug. Could you open a PR to fix it? I guess it is because the group agents are not useful for getting global_minimap anyway that this bug could never cause fatal exceptions on some machines.

@weyenrooney
Copy link
Author

search text in gridworld.py with "_LIB.env_get_info(self.game, -1",it appears 5 times
I fix it in c++ as follow
void GridWorld::get_info(GroupHandle group, const char *name, void *void_buffer) {
// for more information from the engine, add items here
if (group<0 || group>=groups.size())
{
//LOG(FATAL) << "index group out of range " << name;
//return;
group = 0;
}

I build a windows version and debug it

@merrymercy
Copy link
Collaborator

merrymercy commented Feb 12, 2022

@Kipsora is correct. The variable std::vector<Agent*> &agents is never used in this case, so it does not trigger any invalid memory access.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants