Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Breadjesus
Apr 3, 2004
Kami-same
BIG, MEATY COCKS ARE YUMMY IN MY TUMMY!

zsh arrays are 1-indexed as well

Adbot
ADBOT LOVES YOU

Zombywuf
Mar 29, 2008

C does it as well :-)

code:
char *myarray = ((char *)malloc(end_index - start_index + 1)) - start_index;

snare
May 28, 2010
Definitely recently saw database credentials provided as hidden fields in a form which was then submitted with a GET request. Hurrrrrr.

HFX
Nov 29, 2004

snare posted:

Definitely recently saw database credentials provided as hidden fields in a form which was then submitted with a GET request. Hurrrrrr.

Maybe the original implementation of the server didn't support post and no one has bothered to update it?

spiritual bypass
Feb 19, 2008

Grimey Drawer

HFX posted:

Maybe the original implementation of the server didn't support post and no one has bothered to update it?

GET is not the problem.

snare
May 28, 2010
Database credentials. As in those used by the application to connect to the database, not those used by a user to authenticate with the application.

king_kilr
May 25, 2007

snare posted:

Database credentials. As in those used by the application to connect to the database, not those used by a user to authenticate with the application.

Those would be a problem too though.

HFX
Nov 29, 2004

snare posted:

Database credentials. As in those used by the application to connect to the database, not those used by a user to authenticate with the application.

This is why I shouldn't post when I first wake up. I missed what credentials he was talking about.

aeiou
Jul 12, 2006

It's cold in here...
Just kidding! It's to
fool enemies..
Found this in a joomla site that I'm working on fixing:
<?php }}}}?>
This is in an inline script in an article.

Smugdog Millionaire
Sep 14, 2002

8) Blame Icefrog
code:
CREATE TABLE [dbo].[alcotcnctd](
	[Column 0] [nvarchar](50) NULL,
	[Column 1] [nvarchar](50) NULL,
	[Column 2] [nvarchar](50) NULL,
	[Column 3] [nvarchar](50) NULL,
	[Column 4] [nvarchar](50) NULL,
	[Column 5] [nvarchar](50) NULL,
	[Column 6] [nvarchar](50) NULL,
	[Column 7] [nvarchar](50) NULL,
	[Column 8] [nvarchar](50) NULL,
	[Column 9] [nvarchar](50) NULL,
	[Column 10] [nvarchar](50) NULL,
	[Column 11] [nvarchar](50) NULL,
	[Column 12] [nvarchar](50) NULL,
	[Column 13] [nvarchar](50) NULL,
	[Column 14] [nvarchar](50) NULL,
	[Column 15] [nvarchar](50) NULL,
	[Column 16] [nvarchar](50) NULL,
	[Column 17] [nvarchar](50) NULL,
	[Column 18] [nvarchar](50) NULL,
	[Column 19] [nvarchar](50) NULL,
	[Column 20] [nvarchar](50) NULL,
	[Column 21] [nvarchar](50) NULL
)
There are 3 tables like this, each with a million rows or more. I don't know what alcotcnctd means either.

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

Zombywuf posted:

C does it as well :-)

code:
char *myarray = ((char *)malloc(end_index - start_index + 1)) - start_index;

I know you know better than to cast the return value of malloc in C!

floWenoL
Oct 23, 2002

Otto Skorzeny posted:

I know you know better than to cast the return value of malloc in C!

It's necessary in this case because he's doing arithmetic with the return value.

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip
:doh:

Thel
Apr 28, 2010

Smugdog Millionaire posted:

code:
CREATE TABLE [dbo].[alcotcnctd](
<snip>
)
There are 3 tables like this, each with a million rows or more. I don't know what alcotcnctd means either.

Go find Al, and ask him what he concocted. It's the only thing I can come up with that's even remotely close.

TerminX
Oct 1, 2008
:dukedog:

Otto Skorzeny posted:

I know you know better than to cast the return value of malloc in C!
In VS2010, you get a red squiggle under the = in the assignment if you don't do this.

It actually goes as far as to tell you things like "Error: a value of type 'void *' cannot be assigned to an entity of type 'intptr_t *'".

It's quite possibly the most pedantic thing I have ever seen.

MrMoo
Sep 14, 2000

ICC loves to give warnings on C++2003 and C89 errors even though C99 is selected.
code:
556: cannot assign to an entity of type "void *"
589: transfer of control bypasses initialization

Argue
Sep 29, 2005

I represent the Philippines
I mentioned earlier that the code I'm working with takes a pipe-delimited string and does nothing with it. Well now I'm reading the parts that do something with it! (I replaced the variable names because I'm paranoid)

code:
this.foo = response.getFics("OUT1").substring(0, response.getFics("OUT1").indexOf("|"));
temp = response.getFics("OUT1").substring(response.getFics("OUT1").indexOf("|")+1, response.getFics("OUT1").length());
this.foo = temp.substring(0, temp.indexOf("|"));
this.foo = response.getFics("OUT1").substring(response.getFics("OUT1").indexOf("|", response.getFics("OUT1").indexOf("|")+ 1)+1);
this.foo = response.getFics("OUT2").substring(0, response.getFics("OUT2").indexOf("|"));
this.foo = response.getFics("OUT2").substring(response.getFics("OUT2").indexOf("|")+1);
this.foo = response.getFics("OUT3").substring(0, response.getFics("OUT3").indexOf("|"));
this.foo = response.getFics("OUT3").substring(response.getFics("OUT3").indexOf("|")+1);
this.foo = response.getFics("OUT4").substring(0, response.getFics("OUT4").indexOf("|"));
this.foo = response.getFics("OUT4").substring(response.getFics("OUT4").indexOf("|")+1);
this.foo = response.getFics("OUT5").substring(0, response.getFics("OUT5").indexOf("|"));
temp = response.getFics("OUT5").substring(response.getFics("OUT5").indexOf("|")+1, response.getFics("OUT5").length());
this.foo = temp.substring(0, temp.indexOf("|"));
this.foo = response.getFics("OUT5").substring(response.getFics("OUT5").indexOf("|", response.getFics("OUT5").indexOf("|")+ 1)+1);
if(this.foo.equalsIgnoreCase("MB")||(this.foo.equalsIgnoreCase("rv")&&this.foo.equalsIgnoreCase("my"))) {
this.foo = response.getFics("OUT6").substring(0, response.getFics("OUT6").indexOf("|"));
this.foo = response.getFics("OUT6").substring(response.getFics("OUT6").indexOf("|")+1);
}
this.foo = response.getFics("OUT7").substring(0, response.getFics("OUT7").indexOf("|"));
temp = response.getFics("OUT7").substring(response.getFics("OUT7").indexOf("|")+1, response.getFics("OUT7").length());
this.foo = temp.substring(0, temp.indexOf("|"));
this.foo = response.getFics("OUT7").substring(response.getFics("OUT7").indexOf("|", response.getFics("OUT7").indexOf("|")+ 1)+1);
super.customerCareNumber = response.getFics("OUT8").substring(0, response.getFics("OUT8").indexOf("|"));
this.foo = response.getFics("OUT8").substring(response.getFics("OUT8").indexOf("|")+1);
this.foo = response.getFics("OUT9").substring(0, response.getFics("OUT9").indexOf("|"));
this.foo = response.getFics("OUT9").substring(response.getFics("OUT9").indexOf("|")+1);
this.foo = response.getFics("OUT10").substring(0, response.getFics("OUT10").indexOf("|"));
temp = response.getFics("OUT10").substring(response.getFics("OUT10").indexOf("|")+1, response.getFics("OUT10").length());
this.foo = temp.substring(0, temp.indexOf("|"));
this.foo = response.getFics("OUT10").substring(response.getFics("OUT10").indexOf("|", response.getFics("OUT10").indexOf("|")+ 1)+1);

baquerd
Jul 2, 2007

by FactsAreUseless

Argue posted:

I mentioned earlier that the code I'm working with takes a pipe-delimited string and does nothing with it. Well now I'm reading the parts that do something with it! (I replaced the variable names because I'm paranoid)

This is the perfect CS 101 type assignment, right before loops are introduced.

BigRedDot
Mar 6, 2008

code:
char * FML = api->GetPoint(x,y)->getOutput()->getOutputDataSet()->getOutputData()->get(size)->getResultSet();

HFX
Nov 29, 2004

BigRedDot posted:

code:
char * FML = api->GetPoint(x,y)->getOutput()->getOutputDataSet()->getOutputData()->get(size)->getResultSet();


That is not a horror.

Mustach
Mar 2, 2003

In this long line, there's been some real strange genes. You've got 'em all, with some extras thrown in.
That depends on whether or not any of those calls can return NULL.

floWenoL
Oct 23, 2002

TerminX posted:

In VS2010, you get a red squiggle under the = in the assignment if you don't do this.

It actually goes as far as to tell you things like "Error: a value of type 'void *' cannot be assigned to an entity of type 'intptr_t *'".

It's quite possibly the most pedantic thing I have ever seen.

That's probably because it's interpreting it at C++.

Zombywuf
Mar 29, 2008

HFX posted:

That is not a horror.

I disagree, an API should expose a clean interface not let it's guts spill out all over the floor. Then pick up the guts and smack you about the face with them.

shrughes
Oct 11, 2008

(call/cc call/cc)
The real horror is that it returns a char*.

Chairman Steve
Mar 9, 2007
Whiter than sour cream

Mustach posted:

That depends on whether or not any of those calls can return NULL.

try { } catch(NullpointerException e) { }

Done.

:colbert:

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Chairman Steve posted:

try { } catch(NullpointerException e) { }

Done.

:colbert:
Which language has NullPointerException and char* ?

litghost
May 26, 2004
Builder

Janin posted:

Which language has NullPointerException and char* ?

Any C or C++ derivative with support for structured exceptions

Painless
Jan 9, 2005

Turn ons: frogs, small mammals, piles of compost
Turn offs: large birds, pitchforks
See you at the beach!

That's a feature of the platform, not the language

NotShadowStar
Sep 20, 2000

Janin posted:

Which language has NullPointerException and char* ?

C# has char* in unsafe blocks, and not quite NullPointerException but NullReferenceException. Same thing unless you're being exceptionally pendantic.

code:
unsafe {
  String s = "gently caress You!";

  char* c = stackalloc char[s.Length];

  for(int i = 0; i < s.Length; i++)
  {
    c[i] = s[i];
  }

  for (int i = 0; i < s.Length; i++)
  {
    Console.Write((char)c[i]);
  }

  Console.WriteLine("");
  try {
    int* x = null;
    int y;
    y = *(x - 1);
    Console.WriteLine((char)c[y]);
  }
  catch(NullReferenceException e)
  {
    Console.WriteLine("YOU hosed UP");
  }					
}
Incidentally I didn't even know you could do such screwy things in .net land, so that was an a worthwhile research project.

NotShadowStar fucked around with this message at 06:02 on Sep 22, 2010

Mustach
Mar 2, 2003

In this long line, there's been some real strange genes. You've got 'em all, with some extras thrown in.

Chairman Steve posted:

try { } catch(NullpointerException e) { }

Done.

:colbert:
Hey this is a multi-million-dollar enterprise solution. We log our swallowed NPEs around here, mister. Speaking of catching things, here's a nice code review rejection message:

quote:

The assert command is being used, but it is not being caught and handled by anything. Can you either catch and handle the assert errors that may be thrown or remove the assert calls.

Mustach fucked around with this message at 14:58 on Sep 22, 2010

Zombywuf
Mar 29, 2008

code:
} catch (AssertionFailed e) {
  log_exception(e);
  exit(); // Assertion failed, we're hosed, better just shutdown now
}

HFX
Nov 29, 2004

Mustach posted:

Hey this is a multi-million-dollar enterprise solution. We log our swallowed NPEs around here, mister. Speaking of catching things, here's a nice code review rejection message:

Fine.

code:

catch (Exception e) {
      logger.error("Error has occurred:" + e.getMessage());
}

That's 90% of the code I have to debug.

Mustach
Mar 2, 2003

In this long line, there's been some real strange genes. You've got 'em all, with some extras thrown in.
Oh, I feel your pain, man.

Zombywuf posted:

code:
} catch (AssertionFailed e) {
  log_exception(e);
  exit(); // Assertion failed, we're hosed, better just shutdown now
}
I'll kill you.

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.
code:
        private boolean processFulfillmentData(ServletContext app, HttpServletRequest request) {

                boolean processedAllData = true;
                boolean processed = false;

                String localPath = request.getSession().getServletContext().getRealPath(FUL_LOC_PATH + FUL_FILENAME);
                String line = "";

                try {

                        BufferedReader in = null;
                        FileInputStream inp = new FileInputStream(localPath);
                        if (inp != null) {
                                InputStreamReader iReader = new InputStreamReader(inp);
                                if (iReader != null) {
                                        in = new BufferedReader(iReader);
                                        if (in != null) {
                                                boolean parsed = false;
                                                int currentOrderNum = 0;
                                                Vector fItems = new Vector();
                                                while ((line = in.readLine()) != null) {
                                                        // gather all line items from the same order number
                                                        FulfillmentItem fItem = new FulfillmentItem(app, request, line);
                                                        if (fItem.valid()) {
                                                                if (fItem.getEntOrderNum() != currentOrderNum) {
                                                                        // new entOrderNum found; process current order
                                                                        if (currentOrderNum != 0) {
                                                                                processed = processFulfillmentItems(app, request, fItems);
                                                                                if (!processed) {
                                                                                        processedAllData = false;
                                                                                }
                                                                                fItems = new Vector();
                                                                        }
                                                                        currentOrderNum = fItem.getEntOrderNum();
                                                                }
                                                                fItems.add(fItem);
                                                        }
                                                        else {
                                                                Utils.logError(MODULE, "Fulfillment item invalid: [" + fItem + "]");
                                                        }
                                                }
                                                if (!fItems.isEmpty()) {
                                                        processed = processFulfillmentItems(app, request, fItems);
                                                        if (!processed) {
                                                                processedAllData = false;
                                                        }
                                                                       if (currentOrderNum != 0) {
                                                                                processed = processFulfillmentItems(app, request, fItems);
                                                                                if (!processed) {
                                                                                        processedAllData = false;
                                                                                }
                                                                                fItems = new Vector();
                                                                        }
                                                                        currentOrderNum = fItem.getEntOrderNum();
                                                                }
                                                                fItems.add(fItem);
                                                        }
                                                        else {
                                                                Utils.logError(MODULE, "Fulfillment item invalid: [" + fItem + "]");
                                                        }
                                                }
                                                if (!fItems.isEmpty()) {
                                                        processed = processFulfillmentItems(app, request, fItems);
                                                        if (!processed) {
                                                                processedAllData = false;
                                                        }
                                                }
                                                in.close();
                                        }
                                        iReader.close();
                                }
                                inp.close();
                        }
                }
                catch (Exception e){
                        Utils.logJobMgr(MODULE + ".processFulfillmentData()", "*** Error reading file: [" + localPath + "], exception=[" + e.getMessage() + "]");
                        processedAllData = false;
                }
                return processedAllData;
Yup, that's the web application servlet context and request being passed in. To a job. That runs via Quartz.
Also, processFulfillmentItems is even larger than this and has around 15 exit points.
gently caress.

Presto
Nov 22, 2002

Keep calm and Harry on.

BigRedDot posted:

code:
char * FML = api->GetPoint(x,y)->getOutput()->getOutputDataSet()->getOutputData()->get(size)->getResultSet();

The real horror to me with this one is that I know exactly how it was obtained, because I had to write a slew of code identical to this.

You're digging your way down through a pile of auto-generated code to get the thing out that you actually want.

JediGandalf
Sep 3, 2004

I have just the top prospect YOU are looking for. Whaddya say, boss? What will it take for ME to get YOU to give up your outfielders?

Ugg boots posted:

Whenever we submit something that breaks on someone else's machine we always pull this out :D


Beautiful. This is now going to be distributed on every instance of PEBKAC or "I can't get the drat problem to reproduce!" I get.

zootm
Aug 8, 2006

We used to be better friends.

TRex EaterofCars posted:

Yup, that's the web application servlet context and request being passed in. To a job. That runs via Quartz.
Also, processFulfillmentItems is even larger than this and has around 15 exit points.
gently caress.
There are so many horrors here I don't know where to start. Passing the contexts in to the method is just the tip of the iceberg. Terrifying.

Contra Duck
Nov 4, 2004

#1 DAD

TRex EaterofCars posted:

Yup, that's the web application servlet context and request being passed in. To a job. That runs via Quartz.
Also, processFulfillmentItems is even larger than this and has around 15 exit points.
gently caress.

Well that's just stunning. Congratulations :)

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Zombywuf posted:

C does it as well :-)

code:
char *myarray = ((char *)malloc(end_index - start_index + 1)) - start_index;

I had to call short a two-week vacation in Portugal just to tell you that this is technically a violation of the standard.

Adbot
ADBOT LOVES YOU

Larz2021
Feb 2, 2001

Ugg boots posted:

Whenever we submit something that breaks on someone else's machine we always pull this out :D



We have a giraffe.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply