Arithmetic operation overflow

shadow7256
Уже с Приветом
Posts: 10589
Joined: 18 Mar 2004 15:11
Location: New York -> FL

Arithmetic operation overflow

Post by shadow7256 »

Уважаемые, бьюсь с проблемой.

Есть Bitmap объект. Я беру начало битмапа

Code: Select all

IntPtr ptrScan = bitmap.Scan0;
// ширина битмапа
  • var line32 = new byte[ bitmap.Stride ];
вот тут падает Arithmetic operation overflow
Marshal.Copy (strScan, line32, 0, ...)

Смотрю в стек и там такое:

System.OverflowException: Arithmetic operation resulted in an overflow.
2020-05-21 10:44:06.10 [Error] : at System.IntPtr.op_Explicit(IntPtr value)

когда запущено это на 64 битной системе то Размер IntPtr - 64 bit и вот тогда и падает.

Если запущено на 32 битной, то все работает.

Поможите :)
Oleg-NY
Уже с Приветом
Posts: 2475
Joined: 16 Jul 2004 00:32
Location: NY, NY

Re: Arithmetic operation overflow

Post by Oleg-NY »

strScan?
shadow7256
Уже с Приветом
Posts: 10589
Joined: 18 Mar 2004 15:11
Location: New York -> FL

Re: Arithmetic operation overflow

Post by shadow7256 »

Oleg-NY wrote: 21 May 2020 18:06strScan?
Marshal.Copy (ptrScan, line32, 0, ...)

конечно..

Return to “Вопросы и новости IT”