MANTIS / Tiny Bug

Here you can report bugs found in Far Manager.
Post Reply
MortenMacFly
Posts: 45
Joined: Wed 30 Apr, 2008 15:31
Has thanked: 1 time

MANTIS / Tiny Bug

Post by MortenMacFly »

Hi all,
I cannot login into MANTIS (I always get an error "APPLICATION WARNING #2702: Your session has become invalidated.") so I report here:
I found a tiny "bug" in Unicode Far in the file "copy.cpp" at line 3261 ("INT64 Size;"): When the "if" clause ("if(CopySparse)") is false then "Size" is not initialised but is being used in the following "while" clause ("while (CopySparse?(Size>0):true)"). While this may work you cannot be 100% sure for all compilers I'd suppose.
User avatar
Centaur
Posts: 1083
Joined: Tue 05 Apr, 2005 20:09
Location: Novosibirsk, Russia
Been thanked: 2 times

Re: MANTIS / Tiny Bug

Post by Centaur »

C++ Standard ISO/IEC 14882:2003(E) wrote:5.16/1: Conditional expressions group right-to-left. The first expression is implicitly converted to bool (clause 4). It is evaluated and if it is true, the result of the conditional expression is the value of the second expression, otherwise that of the third expression. All side effects of the first expression except for destruction of temporaries (12.2) happen before the second or third expression is evaluated. Only one of the second and third expressions is evaluated.
(emphasis mine).

Similarly:
C Standard ISO/IEC 9899:1999(E) wrote:6.5.15/4: The first operand is evaluated; there is a sequence point after its evaluation. The second operand is evaluated only if the first compares unequal to 0; the third operand is evaluated only if the first compares equal to 0; the result is the value of the second or third operand (whichever is evaluated), converted to the type described below.[92] If an attempt is made to modify the result of a conditional operator or to access it after the next sequence point, the behavior is undefined.
(again, emphasis mine).

If you cannot be 100% sure it works on your compiler, you cannot be 100% sure it is a C/C++ compiler.
MortenMacFly
Posts: 45
Joined: Wed 30 Apr, 2008 15:31
Has thanked: 1 time

Re: MANTIS / Tiny Bug

Post by MortenMacFly »

Mmmmh... good catch. ;-) I have completely overseen this part. So I better shut up.
User avatar
Zeroes
Мультикопипастер Броадкастер
Posts: 569
Joined: Wed 16 Mar, 2005 20:53
Location: Gomel \ Belarus
Has thanked: 1 time
Been thanked: 3 times
Contact:

Re: MANTIS / Tiny Bug

Post by Zeroes »

MortenMacFly

today this bug fixed.
now:
INT64 Size=0;

say thank to DrKnS :)
--- Zeroes & Ones ---
User avatar
DrKnS
Posts: 6114
Joined: Thu 04 Aug, 2005 06:44
Location: Kyiv
Has thanked: 12 times
Been thanked: 426 times

Re: MANTIS / Tiny Bug

Post by DrKnS »

Actually it's not a bug, but uninitialized variables is a bad style, yes.
Toma
Posts: 2
Joined: Tue 30 Aug, 2011 12:20

Re: MANTIS / Tiny Bug

Post by Toma »

If you are behind a web proxy that utilizes multiple exit points, then the session validation will fail, as your session looks like it is being hijacked. In 1.2.0rc1, uncheck the "secure session" option when you log into Mantis to turn off the validation. Alternatively, you can set $g_session_validation = OFF to disable validation for the entire installation, which is not recommended.
Post Reply

Return to “Bug Reports”