<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>yupo5656</author_name>
  <author_url>https://blog.hatena.ne.jp/yupo5656/</author_url>
  <blog_title>memologue</blog_title>
  <blog_url>https://yupo5656.hatenadiary.org/</blog_url>
  <categories>
    <anon>C++</anon>
  </categories>
  <description>void vuln(std::size_t nelem) { int* p = new int[nelem]; std::memset(p, 12345, nelem); }上記の関数には整数オーバーフローに起因するヒープベースバッファオーバーフローの脆弱性があるんですが、どこがまずいかわかりますか？ まずいのはnewしている部分です。C++コンパイラは内部で、nelem * sizeof(int) 、つまりnelem * 0x4U を計算してから、その結果を引数にしてoperator newをcallするんですが*1、もしnelemの値が 0x40000001U だったりしたらどうなるでしょ…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fyupo5656.hatenadiary.org%2Fentry%2F20051227%2Fp2&quot; title=&quot; operator newの隠れた整数オーバーフローとVisualStudio 2005のVC++ - memologue&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url>https://images-fe.ssl-images-amazon.com/images/I/61J5PGR9KGL._SL75_.jpg</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2005-12-27 00:00:01</published>
  <title> operator newの隠れた整数オーバーフローとVisualStudio 2005のVC++</title>
  <type>rich</type>
  <url>https://yupo5656.hatenadiary.org/entry/20051227/p2</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
