Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

trace edit: fix crash/corruption in glsl edit #86

Closed
wants to merge 3 commits into from

2 participants

@gregory38

Argument elements are allocated twice (new + push_back) which corrupt trace generated by glsledit

@gregory38 gregory38 trace edit: fix crash/corruption in glsl edit
The vector is already allocated. Push_back allocate new elements and previous allocated element remains null pointer.
2f5637b
@gregory38

Hum I think there is anothers bug.
Adding an empty line in a good shader introduce this kind of issue:
ERROR: 0:1: error(#132) Syntax error: '<' parse error

gregory38 added some commits
@gregory38 gregory38 glsl edit: copy string content e690feb
@gregory38 gregory38 glsl edit: grep multiline error/warning messages
Useful for GL shader errors which spawn multiple lines error message like that:
    >> 2135: warning: Vertex shader failed to compile with the following errors:
    >> ERROR: 1:1: error(#132) Syntax error: 'sdfsafasf' parse error
    >> ERROR: error(#273) 1 compilation errors.  No code generated
68104b8
@zackr
Owner

Hey, I'm sorry, I missed this pull. I've fixed this error earlier in a week and just pushed it. If you could submit the multiline error/warning as a separate pull that'd be great.

@zackr zackr closed this
@gregory38

Ok I will do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 3, 2012
  1. @gregory38

    trace edit: fix crash/corruption in glsl edit

    gregory38 authored
    The vector is already allocated. Push_back allocate new elements and previous allocated element remains null pointer.
Commits on Jul 6, 2012
  1. @gregory38
  2. @gregory38

    glsl edit: grep multiline error/warning messages

    gregory38 authored
    Useful for GL shader errors which spawn multiple lines error message like that:
        >> 2135: warning: Vertex shader failed to compile with the following errors:
        >> ERROR: 1:1: error(#132) Syntax error: 'sdfsafasf' parse error
        >> ERROR: error(#273) 1 compilation errors.  No code generated
This page is out of date. Refresh to see the latest.
Showing with 14 additions and 3 deletions.
  1. +8 −0 gui/retracer.cpp
  2. +6 −3 gui/saverthread.cpp
View
8 gui/retracer.cpp
@@ -406,6 +406,14 @@ void Retracer::run()
error.type = regexp.cap(2);
error.message = regexp.cap(3);
errors.append(error);
+ } else if (!errors.isEmpty()) {
+ // Probably a multiligne message
+ ApiTraceError &previous = errors.last();
+ if (line.endsWith("\n")) {
+ line.chop(1);
+ }
+ previous.message.append('\n');
+ previous.message.append(line);
}
}
View
9 gui/saverthread.cpp
@@ -246,8 +246,11 @@ class EditVisitor : public trace::Visitor
virtual void visit(trace::String *node)
{
- QString str = m_variant.toString();
- m_editedValue = new trace::String(str.toLocal8Bit().constData());
+ const QByteArray data = m_variant.toString().toLocal8Bit();
+ char* new_data = new char[data.length()+1];
+ memcpy(new_data, data.data(), data.length()+1);
+
+ m_editedValue = new trace::String(new_data);
}
virtual void visit(trace::Enum *e)
@@ -282,7 +285,7 @@ class EditVisitor : public trace::Visitor
return;
}
- newArray->values.push_back(visitor.value());
+ newArray->values[i] = visitor.value();
}
m_editedValue = newArray;
}
Something went wrong with that request. Please try again.