- 1
- 2
- 3
- 4
- 5
- 6
- 7
// Since C++20
struct A {
int&& r;
};
A a1{7}; // OK, lifetime is extended
A a2(7); // well-formed, but dangling reference
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
0
// Since C++20
struct A {
int&& r;
};
A a1{7}; // OK, lifetime is extended
A a2(7); // well-formed, but dangling reference
Удачной отладки!
+2
object Cорок {
infix fun тысяч(b: String) = this
infix fun в(a: String) = this
infix fun сунули(a: String) = this
}
fun main() {
Cорок тысяч "обезъян" в "жопу" сунули "банан"
}
0
<script>
if (!window.BX && top.BX)
window.BX = top.BX;
<?CMedialib::AppendLangMessages();?>
window.<?= $arConfig['event']?> = function(bLoadJS)
{
if (window.oBXMedialib && window.oBXMedialib.bOpened)
return false;
<?if(!CMedialib::CanDoOperation('medialib_view_collection', 0)):?>
return alert(ML_MESS.AccessDenied);
<?else:?>
if (!window.BXMediaLib)
{
if (bLoadJS !== false)
{
// Append CSS
BX.loadCSS("/bitrix/js/fileman/medialib/medialib.css");
var arJS = [];
if (!window.jsAjaxUtil)
arJS.push("/bitrix/js/main/ajax.js?v=<?= filemtime($_SERVER["DOCUMENT_ROOT"].'/bitrix/js/main/ajax.js')?>");
if (!window.jsUtils)
arJS.push("/bitrix/js/main/utils.js?v=<?= filemtime($_SERVER["DOCUMENT_ROOT"].'/bitrix/js/main/utils.js')?>");
if (!window.CHttpRequest)
arJS.push("/bitrix/js/main/admin_tools.js?v=<?= filemtime($_SERVER["DOCUMENT_ROOT"].'/bitrix/js/main/admin_tools.js')?>");
arJS.push("/bitrix/js/fileman/medialib/common.js?v=<?= filemtime($_SERVER["DOCUMENT_ROOT"].'/bitrix/js/fileman/medialib/common.js')?>");
arJS.push("/bitrix/js/fileman/medialib/core.js?v=<?= filemtime($_SERVER["DOCUMENT_ROOT"].'/bitrix/js/fileman/medialib/core.js')?>");
BX.loadScript(arJS);
}
return setTimeout(function(){<?=$arConfig['event']?>(false)}, 50);
}
<?CMedialib::ShowJS()?>
<?
$arSet = explode(',' , CUserOptions::GetOption("fileman", "medialib_user_set", '600,450,0'));
$width = $arSet[0] ? intVal($arSet[0]) : 600;
$height = $arSet[1] ? intVal($arSet[1]) : 450;
$coll_id = $arSet[2] ? intVal($arSet[2]) : 0;
?>
window._mlUserSettings = window._mlUserSettings || {width: <?=$width?>, height: <?=$height?>, coll_id: <?=$coll_id?>}
var oConfig =
{
sessid: "<?=bitrix_sessid()?>",
thumbWidth : <?= COption::GetOptionInt('fileman', "ml_thumb_width", 140)?>,
thumbHeight : <?= COption::GetOptionInt('fileman', "ml_thumb_height", 105) ?>,
userSettings : window._mlUserSettings,
resType: "<?= $resultDest?>",
Types : <?= CUtil::PhpToJSObject(CMedialib::GetTypes($arConfig['types']))?>,
arResultDest : <?= CUtil::PhpToJSObject($arConfig['arResultDest'])?>,
rootAccess: {
new_col: '<?= CMedialib::CanDoOperation('medialib_new_collection', 0)?>',
edit: '<?= CMedialib::CanDoOperation('medialib_edit_collection', 0)?>',
del: '<?= CMedialib::CanDoOperation('medialib_del_collection', 0)?>',
new_item: '<?= CMedialib::CanDoOperation('medialib_new_item', 0)?>',
edit_item: '<?= CMedialib::CanDoOperation('medialib_edit_item', 0)?>',
del_item: '<?= CMedialib::CanDoOperation('medialib_del_item', 0)?>',
access: '<?= CMedialib::CanDoOperation('medialib_access', 0)?>'
},
bCanUpload: <?= $USER->CanDoOperation('fileman_upload_files') ? 'true' : 'false'?>,
bCanViewStructure: <?= $USER->CanDoOperation('fileman_view_file_structure') ? 'true' : 'false'?>,
strExt : "<?= CUtil::JSEscape(CMedialib::GetMediaExtentions())?>",
lang : "<?= $arConfig['lang']?>",
description_id : '<?= CUtil::JSEscape($arConfig['description_id'])?>'
};
window.oBXMedialib = new BXMediaLib(oConfig);
oBXMedialib.Open();
<?endif;?>
};
</script>
0
format pe console 5.0
entry start
include 'win32ax.inc'
SLEEP=1000
section '.data' data readable
_hello db 'Hello "https://www.govnokod.ru/"!',13,10,0
_conout db 'CONOUT$',0
align 8
_conoutnt du '\??\CONOUT$',0
section '.data?' data readable writeable
bytes_write dd ?
houtput dd ?
length dd ?
section '.text' code readable executable
start:
call _novice
invoke Sleep,SLEEP
call _advanced
invoke Sleep,SLEEP
call _psycho
invoke Sleep,SLEEP
invoke ExitProcess,0
_novice:
invoke GetStdHandle,STD_OUTPUT_HANDLE
mov [houtput],eax
invoke lstrlen,_hello
mov [length],eax
invoke WriteConsole,[houtput],_hello,[length],bytes_write,0
ret
_advanced:
invoke CreateFileA,_conout,GENERIC_WRITE,0,0,OPEN_EXISTING,0,0
mov [houtput],eax
invoke lstrlen,_hello
mov [length],eax
invoke WriteFile,[houtput],_hello,[length],bytes_write,0
invoke CloseHandle,[houtput]
ret
_psycho:
push ebx
sub esp,40
mov ebx,esp
mov word[ebx+24],22
mov word[ebx+26],24
mov dword[ebx+28],_conoutnt
mov dword[ebx+0],24
mov dword[ebx+4],0
lea eax,[ebx+24]
mov dword[ebx+8],eax
mov dword[ebx+12],$00000040
mov dword[ebx+16],0
mov dword[ebx+20],0
lea eax,[ebx+32]
invoke NtCreateFile,houtput,$40100080,ebx,eax,0,0,0,1,$60,0,0
invoke lstrlen,_hello
mov [length],eax
lea eax,[ebx+32]
invoke NtWriteFile,[houtput],0,0,0,eax,_hello,[length],0,0
invoke NtClose,[houtput]
add esp,40
pop ebx
ret
section '.import' data import readable
library\
ntdll,'ntdll.dll',\
kernel32,'kernel32.dll'
import ntdll,\
NtClose,'NtClose',\
NtCreateFile,'NtCreateFile',\
NtWriteFile,'NtWriteFile'
include 'api\kernel32.inc'
section '.reloc' fixups data readable discardable
Интересно какой из методов (_novice, _advanced, _psycho) вывода в консоль является говнокодом?
+1
#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
using namespace std;
string pswdGen(int quantity) {
srand(time(0));
char chars[] = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890@\#\$\%\&\-\+\!\/\_"; // Символы, из которых будет состоять пароль
string password;
for(int i = 0; i < quantity; i++) {
password += chars[rand() % (sizeof(chars)/sizeof(*chars))]; // Добавить рандомный символ из списка в пароль
}
return password;
}
int main() {
int charNo;
cout << "How many characters do you want in the password?" << endl;
cin >> charNo;
cout << "Your new password is: " << pswdGen(charNo) << endl;
return 0;
}
Генерит произвольные пароли. Говно?
−2
Object oriented style
string mysqli::escape_string ( string $escapestr )
string mysqli::real_escape_string ( string $escapestr )
Procedural style
string mysqli_real_escape_string ( mysqli $link , string $escapestr )
http://php.net/manual/en/mysqli.real-escape-string.php
+5
<?php
class Govno
{
function __toString()
{
return 'govno';
}
}
${'<?php'} = 42;
${M_PI} = 43;
${new Govno} = 44;
${"\0"} = 45;
${''} = 46;
${null} = 47;
${create_function('', 'return null;')} = 444;
ob_start();
phpinfo();
${ob_get_clean()} = 9000;
var_dump(get_defined_vars());
В ПХП возможно всё, если делать это через жопу.
https://ideone.com/svS2sO
−1414
function Unescape(const s: AnsiString): widestring;
var
i: Integer;
j: Integer;
c: Integer;
begin
// Make result at least large enough. This prevents too many reallocs
SetLength(Result, Length(s));
i := 1;
j := 1;
while i <= Length(s) do begin
if s[i] = '\' then begin
if i < Length(s) then begin
// escaped backslash?
if s[i + 1] = '\' then begin
Result[j] := '\';
inc(i, 2);
end
// convert hex number to WideChar
else if (s[i + 1] = 'u') and (i + 1 + 4 <= Length(s))
and TryStrToInt('$' + string(Copy(s, i + 2, 4)), c) then begin
inc(i, 6);
Result[j] := WideChar(c);
end else begin
raise Exception.CreateFmt('Invalid code at position %d', [i]);
end;
end else begin
raise Exception.Create('Unexpected end of string');
end;
end else begin
Result[j] := WideChar(s[i]);
inc(i);
end;
inc(j);
end;
// Trim result in case we reserved too much space
SetLength(Result, j - 1);
end;
Это не вирус. Просто в Delphi 7 не завезли JSon.
+2
CharT getline(std::istream& i, string& s, const CharT* delim) {
...
if (!i.operator void*())
break;
...
}
Библиотека Apache UIMA-CPP.
Что могло заставить написать так, вместо обычного if (i)? Какой-то древний компилятор, который не использует каст к указателю в условии?
Ну и, разумеется, в C++11 ios::operator void*() заменили на explicit ios::operator bool(), так что работать перестало.
+8
public TD GetColumn(int i) {
try {
return this.Columns[i];
} catch {
return this.Columns[i - 1];
}
}
в продолжение парсера