Raised This Month: $51 Target: $400
 12% 

Solved Possible of index out of bounds error in GetAttachment


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-09-2023 , 21:20   Possible of index out of bounds error in GetAttachment
Reply With Quote #1

PHP Code:
    for (int i chainlength 1>= 0i--)
    {
        
int bone chain[i];
        
int parent pbones[bone].parent;
        
QuaternionMatrix(q1[bone], bonematrix);

        
bonematrix[0][3] = pos1[bone][0];
        
bonematrix[1][3] = pos1[bone][1];
        
bonematrix[2][3] = pos1[bone][2];
        
R_ConcatTransforms((parent == -1) ? rotationmatrix bonetransform[parent], bonematrixbonetransform[bone]);
    } 
according to the code from REHLDS it seems "i" will reach out of bounds at -1 due the following condition.

Code:
 i >= 0
Can some one prove otherwise ?

Btw this function "GetAttachment from r_studio.cpp" is so buggy i've tested it out multiple times and sometimes the results of the origin of the attachment get shifted randomly, any solutions on how to fix that?
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 07-13-2023 at 18:12.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-09-2023 , 23:41   Re: Possible of index out of bounds error in GetAttachment
Reply With Quote #2

Quote:
Originally Posted by Natsheh View Post
PHP Code:
    for (int i chainlength 1>= 0i--)
    {
        
int bone chain[i];
        
int parent pbones[bone].parent;
        
QuaternionMatrix(q1[bone], bonematrix);

        
bonematrix[0][3] = pos1[bone][0];
        
bonematrix[1][3] = pos1[bone][1];
        
bonematrix[2][3] = pos1[bone][2];
        
R_ConcatTransforms((parent == -1) ? rotationmatrix bonetransform[parent], bonematrixbonetransform[bone]);
    } 
according to the code from REHLDS it seems "i" will reach out of bounds at -1 due the following condition.

Code:
 i >= 0
Can some one prove otherwise ?
I'm quite sure that i will never be -1 because of that condition. When i becomes -1 then that expression will evaluate to false and the code in the for loop will not execute again.
__________________

Last edited by fysiks; 07-09-2023 at 23:47. Reason: set font of variable in sentence
fysiks is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-10-2023 , 07:27   Re: Possible of index out of bounds error in GetAttachment
Reply With Quote #3

GetAttachment is a really helpful function too bad it cant be used due the incorrect results that sometimes acquires when the entity is rotated, ill just use offsets when entity angles and origin are equal to 0 0 0 and do the rotation math.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 07-10-2023 at 07:28.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:43.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode