Viewing Issue Simple Details Jump to Notes ] Wiki ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002360 [DCSS] Bug Report minor random 2010-08-24 05:29 2010-08-24 08:57
Reporter reid View Status public  
Assigned To rob
Priority normal Resolution done  
Status resolved   Product Branch 0.7 ancient branch
Summary 0002360: read past end of array in unrandart selection
Description get_unrand_specialness in artefact.cc contains the following code:

    if (unrand_index < UNRAND_START || unrand_index > UNRAND_LAST)
        return (UNRANDSPEC_NORMAL);

    if (unranddata[unrand_index].flags & UNRAND_FLAG_SPECIAL)
        return (UNRANDSPEC_SPECIAL);

The condition of the second if is wrong; unrand_index = UNRAND_START corresponds to element 0 of the unranddata array. "unranddata[unrand_index]" should be replaced by "unranddata[unrand_index - UNRAND_START]".

This can plausibly explain the recent odd unrand generation on CAO and CDO. If, for example, the only special unrand armour according to the above code happens to be salamander leather hide, then whenever _try_make_armour_artefact calls _try_make_item_special_unrand, salamander hide armour will be generated, which could be significantly more often than any other particular unrand is generated.
Additional Information
Tags No tags attached.
Attached Files

- Relationships

-  Notes
(0007523)
rob (developer)
2010-08-24 08:57

fixed, thanks

- Issue History
Date Modified Username Field Change
2010-08-24 05:29 reid New Issue
2010-08-24 08:57 rob Note Added: 0007523
2010-08-24 08:57 rob Status new => resolved
2010-08-24 08:57 rob Fixed in Branch => 0.8 development branch
2010-08-24 08:57 rob Resolution open => done
2010-08-24 08:57 rob Assigned To => rob


Mantis 1.1.8[^]
Copyright © 2000 - 2009 Mantis Group
Powered by Mantis Bugtracker