JP1 Remotes Forum Index JP1 Remotes

FAQFAQ SearchSearch 7 days of topics7 Days MemberlistMemberlist UsergroupsUsergroups RegisterRegister
ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in

Bug in ExchangeIR/FindRepeat, C and Java versions

Post new topic   Reply to topic    JP1 Remotes Forum Index -> JP1 - Software
View previous topic :: View next topic  
Author Message

Joined: 24 Oct 2008
Posts: 1010

PostPosted: Sun Jul 13, 2014 9:33 am    Post subject: Bug in ExchangeIR/FindRepeat, C and Java versions Reply with quote

While working in IrScrutinizer, I found out that if the IR sequence

causes the Java version of ExchangeIR/FindRepeat, called RepeatFinder, to misbehave. It will cause the function

protected boolean equalTimes(int[] t1, int offset1, int[] t2, int offset2, int duration_count) {
   for (int i = 0; i < duration_count; i++) {
                if (!equalTimes(t1[i + offset1], t2[i + offset2])) 

to be called with t1 and t2 integer arrays of length 86, offset1 = 68, offset2 = 84, duration_count = 14. As is easily seen, three iterations into the loop, and this will try to access t2 outside of its allocated area, throwing an ArrayIndexOutOfBoundsException. I tried the original C version, and it shows exactly the same behavior, just, as C (C++ really), it does not throw an exception, but just gets "something" (undefined) from memory, and happily computes on that. (With bad luck, segmentation errors may result though.) Since (approximate) equality is tested, likely the function will return false.

The quick fix I will implement in the Java version is just to catch the exception, and return false; it is probably fairly innocent (equality was to be tested).
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic       JP1 Remotes Forum Index -> JP1 - Software All times are GMT - 5 Hours
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Get Smart! the band's official homepage Rockabilly Central