小编n3v*_*m03的帖子

处理嵌入式SVG脚本标记中的字符引用

这是一个xss脚本:

<svg><script>&#x61;&#x6c;&#x65;&#x72;&#x74;&#x28;&#x31;&#x29;</script></svg>
Run Code Online (Sandbox Code Playgroud)

<script>标签之间的代码将由alert(1)浏览器转换并执行.

但是如果我不使用<svg>标签,代码将不会被翻译成脚本.谁能告诉我为什么会这样?<svg>标签如何工作?

html javascript xss svg

9
推荐指数
1
解决办法
112
查看次数

如何多线程 glfw 键盘回调?

我正在创建一个 opengl 应用程序,当我不使用多线程时它运行良好。原始代码如下所示:

void Controller::BeginLoop()    
{    
    while (!glfwWindowShouldClose(_windowHandle)) {    
        /* Render here */     
        Render();    

        /* Swap front and back buffers */     
        glfwSwapBuffers(_windowHandle);

        /* Poll for and process events */     
        glfwPollEvents(); 
    }     
}    

int main()
{
    //do some initialization
    g_controller->BeginLoop();
}
Run Code Online (Sandbox Code Playgroud)

上面的代码运行良好,但是,当我尝试将事件轮询和渲染放入两个不同的线程时,OpenGL 不会在窗口中绘制任何内容。下面是我使用的多线程代码:

void Controller::BeginLoop()    
{    
    while (!glfwWindowShouldClose(_windowHandle)) {  

        glfwMakeContextCurrent(_windowHandle);

        /* Render here */     
        Render();    

        /* Swap front and back buffers */     
        glfwSwapBuffers(_windowHandle);
    }     
}    



void Render(int argc, char **argv)
{
    ::g_controller->BeginLoop();
}

int main()
{

    std::thread renderThread(Render, argc, argv);

    while …
Run Code Online (Sandbox Code Playgroud)

c++ opengl multithreading glfw

5
推荐指数
1
解决办法
1693
查看次数

程序的运行速度是否与调试模式或发布模式有关?

我的程序在调试模式和发布模式下运行的速度在VS2012中有很大差异.但是,无论我是使用调试模式(使用-g选项)还是使用释放模式,当我使用g ++运行我的程序时,速度几乎没有变化.谁能告诉我这是不是普通的?

c++ compiler-construction

1
推荐指数
2
解决办法
263
查看次数