Tell me, please (preferably a C ++ example), how does the stack (buffer) overflow occur when performing a division operation? In runet found a similar topic, but on Assembler, and I in it or in the tooth foot.

  • So stack or buffer? - skegg
  • Maybe it was worth giving a link to the very similar topic on the Assembler? - VadimTukaev

2 answers 2

Well, if you divide a very large number by a very small number ( 1e200 / 1e-200 ), it is like multiplying two large numbers. So much for the overflow.

    Are you sure that this is a stack / buffer overflow?

    Maybe all the same arithmetic (in particular, the division by zero) .

    • about the stack or buffer is not sure. The lecturer said simply overflow when dividing - Roman1
    • @ Roman Ponomarenko, if we are talking about stack overflow when performing a division operation (I hear it for the first time), then you don’t take the trouble when you find out at least some details - drop a few lines here. - avp
    • @avp I understand, variable overflow. Ie if int delta = 21 2 147 483 647 + 1 - an overflow will occur. - Roman1
    • This is arithmetic. See the link in the answer. - avp