overflow

Java multiply operation behavior

I wrote a method to convert a given number from days to milliseconds: private long expireTimeInMilliseconds; ... public void setExpireTimeInDays(int expireTimeInDays) { expireTimeInMilliseconds = expireTimeInDays * 24 * 60 * 60 * 1000; } I had a hard time to figure out what I did wrong. Now my question: Is that error so obvious ? ...

Common Causes of - Buffer Overflow Errors under .NET

I'm looking for common causes of Buffer Overflow errors under .NET. I know that buffer overflow is impossible under managed .NET code. However this exception is still possible in the scope of .NET application. Things I thought of - Valid arguments to COM object calls Valid arguments to PInvoke/Win32 calls What is the best method o...

CSS Underflow fix

Hi Folks, I'm wondering if there are any underflow fixes for css? The initial problem was an overflow which is easily fixed but has now become an underflow problem.I have set a specific height value but it just seems to ignore this and instead resizes to suit the contents. I appreciate any help and ideas. Thanks! ...

Internet explorer css overflow Problem

Hi all, I wanted to know if there was a way to fix scrollbar issue i'm having with ie7. Here is my CSS .gridContainer { height: 500px; width: 410px; background-color:#fff; border:1px solid #6699CC; overflow:auto; } .Grid {background-color:#fff;width:100%;} .Grid td { border-top:1px solid #C4DDFF; height:13px; min-width:30px; text-al...

Why this specific operation overflow (cf. CS0220) in C# ?

I try to construct a big Int64 with nibble information stored in bytes. The following lines of code work as expected: Console.WriteLine("{0:X12}", (Int64)(0x0d * 0x100000000)); Console.WriteLine("{0:X12}", (Int64)(0x0d * 0x1000000)); Console.WriteLine("{0:X12}", (Int64)(0x0d * 0x100000)); Why does the following line lead to a compile...

Stack Overflow during SWAP

How can we take care of the overflow happening during swapping of two variables without using a third variable. I believe the XOR solution can be used only for integers. what about other variable types? ...

What is smallest offset for which I can safely omit overflow checking when I add it to a pointer?

Hi, Can I expect that any "data" pointer in user space programs lies in a safe distance from the addresses 0 and 0xffffffff..., so that I can safely add a small offset to the pointer without checking for an overflow? What is the largest positive n for which I can safely assume that p + n doesn't overflow when p is a char pointer into a ...

In case of integer overflows what is the result of (unsigned int) * (int) ? unsigned or int?

In case of integer overflows what is the result of (unsigned int) * (int) ? unsigned or int? I was auditing the following function, and suddenly I came out with that question. In the below function, it is vulnerable at line 17. 1. // Create a character array and initialize it with init[] 2. // repeatedly. The size of this character ...

C integer overflow behaviour when assigning to larger-width integers

If I execute the following code in C: #include <stdint.h> uint16_t a = 4000; uint16_t b = 8000; int32_t c = a - b; printf("%d", c); It correctly prints '-4000' as the result. However, I'm a little confused: shouldn't there be an arithmetic overflow when subtracting a larger unsigned integer from the other? What casting rules are ...

How can I access the actual text that is displayed in a DIV when using CSS style overflow: hidden?

I have the following content DIV on my page, which displays dynamic text: <div id="someContent"> </div> It uses the following CSS to cut off additional text: #someContent { height: 200px; width: 200px; overflow: hidden; } If I load this text into the DIV: "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praes...

Can a text widget show overflow with the "..." in the middle of the text instead of the end?

I have a JComboBox which contains an MRU list combo-box and a for a directory tree panel. Together, the two form the left hand panel of my GUI (the MRU is above the tree panel) which is a JSplitPane, so the left panel is resizeable. It has a problem in that the directory text is always longer than the required width to see that directo...

C language: #DEFINEd value messes up 8-bit multiplication. Why?

I have the following C code: #define PRR_SCALE 255 ... uint8_t a = 3; uint8_t b = 4; uint8_t prr; prr = (PRR_SCALE * a) / b; printf("prr: %u\n", prr); If I compile this (using an msp430 platform compiler, for an small embedded OS called contiki) the result is 0 while I expected 191. (uint8_t is typedef'ed as an unsigned char) If I ch...

Overflow In c

Hi, I have a doubt When two 16 bit values are added with max values, will there be overflow in the 16 bit machines? I will elaborate unsigned short a; unsigned short b; unsigned long c; c=(unsigned long)(a+b); Talking about 16 bit processers the accumulator will be of 16 bit size. Will there be an overflow in the above statement...

Scriptaculous / prototype Draggable and overflow issue

I have a problem similar to this one (here): I am having an undesired effect when I drag a div from a container div which is set as overflow: scroll. I have found an example of someone else where they have had the issue but I have been unable to find a resolution Example on Paste bin What happens is that the ...

CSS + .MOV Object

Hello all, I've created a page that uses jquery to slide from left to right displaying content in the middle of the page, everything around the centre is hidden via "overflow: hidden" which works a charm, until I embedded via the tags a quicktime video, it isn't hidden / it is always visible. I have no idea why this is happening and wou...

Integer Overflow

I have an unsigned long long that I use to track volume. The volume is incremented by another unsigned long long. Every 5 seconds I print this value out and when the value reaches the 32 bit unsigned maximum the printf gives me a negative value. The code snippet follows: unsigned long long vol, vold; char voltemp[10]; ...

CSS overflow with long URL

Ok, so I have google ads inside a 160x600 container. New ads are shown randomly on refresh. When an ad pops up with a long URL that doesn't contain any dashes or any characters for it to break at, it overflows out of the container div. Right now I have overflow:hidden so anything after 160 pixels in hidden. The problem is that if ther...

Stack overflows from deep recursion in Java?

After some experience with functional languages, I'm starting to use recursion more in Java - But the language seems to have a relatively shallow call stack of about 1000. Is there a way to make the call stack bigger? Like can I make functions that are millions of calls deep, like in Erlang? I'm noticing this more and more when I do Pr...

How can I increase the stack memory?

Duplicate of http://stackoverflow.com/questions/743545/how-to-allow-more-memory-and-avoid-stack-overflow-on-lots-of-recursion I'm writing a branch and bound algorithm which has at least 10000 levels by a recursive function,but it doesn't work due to a stack overflow error. here is a simple instance of my program in C++: void f(int k) {...

How to prevent a stack overflow by monitoring the stack size?

Many C/C++/Fortran and other programmers would have come across "stack overflow" errors. My question is, Is there a tool, a program or a simple code snippet, that allow us to monitor or check the size of the stack while the program is running? This may be helpful to pinpoint where the stack is being accumulated and eventually causing ove...