LINUX.ORG.RU

История изменений

Исправление shdown, (текущая версия) :

Ну и найди мне там out-of-boundary acces или доступ к уже освобожденной вручную памяти. Это типичные уязвимости в сишке.

Доступ к уже освобожденной памяти перечислен во втором пункте этого документа:

Evaluating a dereference expression (*expr) on a raw pointer that is dangling or unaligned, even in place expression context (e.g. addr_of!(*expr)).

Out-of-boundary access, очевидно, тоже является undefined behavior. Даже само получение указателя на фиг-знает-что (за пределами валидного объекта в памяти) им является (https://doc.rust-lang.org/std/primitive.pointer.html#method.offset):

If any of the following conditions are violated, the result is Undefined Behavior:

  • Both the starting and resulting pointer must be either in bounds or one byte past the end of the same allocated object.
  • The computed offset, in bytes, cannot overflow an isize.
  • The offset being in bounds cannot rely on “wrapping around” the address space. That is, the infinite-precision sum, in bytes must fit in a usize.

Исходная версия shdown, :

Ну и найди мне там out-of-boundary acces или доступ к уже освобожденной вручную памяти. Это типичные уязвимости в сишке.

Доступ к уже освобожденной памяти перечислен во втором пункте этого документа:

Evaluating a dereference expression (*expr) on a raw pointer that is dangling or unaligned, even in place expression context (e.g. addr_of!(*expr)).

Out-of-boundary access, очевидно, тоже является undefined behavior. Даже получение указателя на непонятно что им является (https://doc.rust-lang.org/std/primitive.pointer.html#method.offset):

If any of the following conditions are violated, the result is Undefined Behavior:

  • Both the starting and resulting pointer must be either in bounds or one byte past the end of the same allocated object.
  • The computed offset, in bytes, cannot overflow an isize.
  • The offset being in bounds cannot rely on “wrapping around” the address space. That is, the infinite-precision sum, in bytes must fit in a usize.